【发布时间】:2014-03-14 20:27:18
【问题描述】:
我的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>
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);
}
});
});
当我点击提交按钮时,我的 ajax 请求不起作用,看起来好像控件正在传递给 JQuery 提交函数,但是 ajax 请求没有执行/正常工作,这是怎么回事?
【问题讨论】:
-
您遇到的错误是什么?
-
没有错误,只是ajax调用不工作
-
@KiranGopalakrishnan 你是怎么解决的?还是不行?
-
@KiranGopalakrishnan 你是怎么解决的?如果您分享解决方案会很好......