在JQuery对话框中提交HTML表单 [英] Submitting HTML form in JQuery dialog

查看:110
本文介绍了在JQuery对话框中提交HTML表单的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图转换现有的HTML表单,并使其显示在JQuery对话框中。我不确定如何更改代码,以便点击提交按钮后提交数据。我的代码如下:

I am trying to convert an existing HTML form and make it appear in JQuery dialog. I am not sure how to change the code so the data is submitted after clicking the submit buton. My code is a follows:

旧形式:

Old form:

<form method="post" name="callbackrequest" id="ccallbackrequest" action="action.php" onsubmit="return validateThis(this)">

<button type="submit" class="submit">Submit Request</button>

新表格:

New form:

buttons: {
                "Submit": function() {
if ( bValid ) {

        HERE GOES THE CODE!

        $( this ).dialog( "close" );
              }

然后是新的表单:

Then there is the new form:

<form class="center" method="post" name="callbackrequest" id="ccallbackrequest" action="??">
 fields listed
no submit button
</form>

任何关于如何处理这个问题的建议?

Any advice on how should I handle this?

推荐答案

尝试 $('#ccallbackrequest')。submit(); 。 submit方法只提交选择器返回的任何一个。

Try $('#ccallbackrequest').submit();. The submit method just submits whichever from is returned by the selector.

这篇关于在JQuery对话框中提交HTML表单的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆