我的HTML就像这样,
<form name="postcontent" id="postcontent">
<input name="postsubmit" type="submit" id="postsubmit" value="POST"/>
<textarea id="postdata" name="postdata" placeholder="What's Up ?"></textarea>
</form>
Run Code Online (Sandbox Code Playgroud)
jquery代码如下
$("#postcontent").submit(function(e) {
$.ajax({
type:"POST",
url:"add_new_post.php",
data:$("#postcontent").serialize(),
beforeSend:function(){
$(".post_submitting").show().html("<center><img src='images/loading.gif'/></center>");
},success:function(response){
//alert(response);
$("#return_update_msg").html(response);
$(".post_submitting").fadeOut(1000);
}
});
});
Run Code Online (Sandbox Code Playgroud)
当我单击提交按钮时,我的ajax请求不起作用,看起来好像控件正在传递给JQuery提交函数,但是ajax请求没有执行/正常工作,有什么问题?