前端之家收集整理的这篇文章主要介绍了
ajax click,
前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。
$(".submit").click(function(){
var datatime=$("#datatime").val();
$.ajax({
type:"POST",url: "http://www.demo.com/demo.PHP",data: "datatime="+datatime,dataType: "json",beforeSend: function(){
$(".update_data").empty();
$(".update_data").html("<img src=\'http://www.demo.com/imgs/wait.gif\' width=\'561\' height=\'160\' />");
},success: function(data) {
$(".update_data").empty();
var mess = "处理完成,请关闭!";
if(data.<span>Variable1</span> == data.<span>Variable2</span>){
//write your code
}else{<pre name="code" class="PHP"> //write your code
}
}
});
});
原文链接:https://www.f2er.com/ajax/164058.html