0

我对 JQuery 完全陌生。

我想获得有关如何将值从 jquery 对话框表单传递到 php 文件以进行处理的解决方案。

请参考此链接作为jquery 对话框表单的示例

请注意:对话框表单的示例将值传递给表格并显示。就我而言,我想将它们传递给另一个页面(.php 文件)。

非常感谢您的帮助:)

代码:-脚本

if(bValid)
{
  $.post("scripts/appointment.php",{  name: name.val(),
                                     email: email.val(),
                                   contact: contact.val(),
                                      file: filenumber.val(), 
                                    reason: reason.val(),
                                  app_date: appdate.val(),
                                      time: apptime().val,
                                     visit: getRadioValue()},
                     function(data){
                         $("#dialog-form").slideUp("normal", function() {
                         $("#dialog-form").before('<h1>Success</h1><p>Your Appointment was sent.</p>');
 }); }
);  

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

-形式

<div id="dialog-form" title="Make an appointment">
  <p class="validateTips">Please fill in the form to book an appointment.<br>If the
  booking is not available we will notify you!</p>

   <form>
     <fieldset>
       <label for="patient"><b>First Time Visit?</b></label>
     <input type="radio" name="patient" id="patient_state" value="Yes">Yes<br>
 <input type="radio" name="patient" id="patient_state" value="No">No<br><hr>
<label for="filenumber">File No.</label>
<input type="text" name="filenumber" id="filenumber" value="" class="text ui-widget-content ui-corner-all" />
<label for="reason">What's your reason for visit?</label>
<input type="text" name="reason" id="reason" value="type reason here..." class="text ui-widget-content ui-corner-all" />
<label for="name">Name</label>
<input type="text" name="name" id="name" class="text ui-widget-content ui-corner-all" />
<label for="email">Email</label>
<input type="text" name="email" id="email" value="" class="text ui-widget-content ui-corner-all" />
<label for="contact">Contact No.</label>
<input type="text" name="contact" id="contact" value="" class="text ui-widget-content ui-corner-all" />
<label for="appdate">Date</label>
<input type="text" name="appdate" id="datepicker" value="" class="text ui-widget-content ui-corner-all" />
<label for="apptime">Time</label>
 <input type="text" name="apptime" id="apptime" value="HH:MM" class="text ui-widget-  
 content ui-corner-all" />
  </fieldset>
 </form>
</div>
4

1 回答 1

0

这意味着您必须在书本按钮上绑定点击事件:

$('#bookButton').click(function() {
    // perfom check
    if (bValid) {
        // other code
    }
});
于 2013-07-13T15:02:18.657 回答