我有一个php页面"formpage.php",里面有一个类似这样的表单:
<div id='hiddenform' style='display:hidden'>
<form name="testform" action="formpage.php" method="post">
Username: <input type="text" name="user">
<input type="submit" value="Submit">
</form>
</div>此表单使用jquery和简单模式(示例)显示:
$(".show_hide").click(function(){
$('#hiddenform').modal({overlayClose:true});
});一切正常,框打开与SimpleModal和表单显示,但我不能提交表单,当我按下提交按钮没有任何反应。我该怎么办?表单和提交在没有SimpleModal的情况下工作得很好。
我希望将表单(用SimpleModal打开)提交给formpage.phhp (self),然后在脚本中进一步使用posted变量。
谢谢你的帮助!
发布于 2013-02-26 06:37:32
这行得通吗?如果它做了什么,你的js会阻止表单的默认行为(可能是简单的might,也可能是其他的):
$(".show_hide").click(function(){
$('#hiddenform').modal({
overlayClose:true,
onShow: function() {
$('.simplemodal-data input[type=submit]').click(function() {
$.post('the_url_where_you_want_to_send_your_data_to', $(this).closest('form').serialize(), function(data) { alert('we have a response and form has been sent!'); })
}
}
});
});https://stackoverflow.com/questions/15077359
复制相似问题