日期:2014-05-16 浏览次数:20830 次
<script type="text/javascript">
$(document).ready(function(){
$("#apple").click(function(event){
var s=$("#ppp").val();
if(s!=''){
$.post("UserVerify?rand="+Math.rand,{a:s},function(data){
$("#maple").html(data);
});
alert( $("#maple").html());
event.preventDefault();
//return false;
}else {
alert("请输入");
event.preventDefault();
}
});
});
</script>
</head>
<body>
<form action="shiyan" method="post">
<input type="text" id="ppp">
<span id="maple"></span>
<input type="submit" value="点击" id="apple">
</form>
</body>
</html>
$(document).ready(function(){
$("#apple").click(function(event){
var s=$("#ppp").val();
if(s!=''){
$.post("UserVerify?rand="+Math.rand,{a:s},function(data){
$("#maple").html(data);
alert( $("#maple").html());///////////
});
//alert( $("#maple").html());//ajax还没有返回都已经执行这句了,当然为空了,第二次的话已经有第一次的结果了,输出当然不为空
event.preventDefault();
//return false;
}else {
alert("请输入");
event.preventDefault();
}
});
});