<a href="other.php?id={$item.id}&name={$item.name}&html={$item.html}&content={$item.content}" onclick="return Validate();">修改</a></td>
点击"修改"时, 用ajax是否可能获取到 id = 2 & name = 张三
点击"修改"时, 用ajax是否可能获取到 id = 2 & name = 张三
<head>
<meta http-equiv="content-type" content="text/html;charset=gb2312"/>
<script type="text/javascript">
function Validate(el){
var ptrn=/id=([^&]+)&name=([^&]+)/
if(ptrn.test(el.href)){
alert(RegExp.$1);//id
alert(RegExp.$2);//name
}
return false;
}
</script>
</head>
<body>
<a href="other.php?id=123&name=Micheal&html=0&content=0" onclick="return Validate(this);">修改</a>
</body>
</html>