df
2014-05-15 20:45:38 +08:00
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>test jq ajax</title>
<script src="js/jquery-1.7.2.min.js"></script>
</head>
<body>
<a href="###" id="abc">123</a>
<a href="###" id="bbb">2</a>
<script type="text/javascript">
$(document).ready(function(){
var a;
$('#abc').bind('click',function(){
console.log(a);
})
$("#bbb").bind('click',
function(){
$.ajax({
url:'1.php',
type:'post',
data:{},
success:function(data){
a = data.n; // $json = '{"n":2}';
console.log(a);
alert(1);
}
})
});
});
</script>
</body>
</html>