【发布时间】:2012-08-12 00:23:58
【问题描述】:
我正在尝试使用 jquery 提交表单。我正在使用引导模式窗口。这是js fiddle。我错过了什么吗?非常感谢
更新:我正在尝试使用 ajax 提交表单。 我也尝试过,但没有运气。
$('#comment_form').on('submit', function(){
$.post("/yourReceivingPage", $(this).serialize(), function(){
// Hide the modal
$("#my-modal").modal('hide');
});
// Stop the normal form submission
return false;
});
【问题讨论】:
-
您所指的php页面的名称是什么?
/yourReceivingPage?你从萤火虫那里得到任何其他错误吗?您的页面上是否还有其他框架,例如原型? -
你能告诉我你发送什么到.php文件当你点击post时生成了什么字符串?尝试使用
alert()来解决问题,.serialize()之后可能会出现问题 -
我想我已经找到了你的答案,请看这里:stackoverflow.com/questions/920294/jquery-serialize-and-post