2013-07-13 34 views
0

我对JQuery完全陌生。jquery对话框后值到php页面

我想获得一个解决方案,如何将值从一个jQuery对话框形式传递到一个PHP文件进行处理。

请参考this link作为一个例子的jquery dialog form

请注意:该对话框形式的实例将值传递到一个表和显示器。在我的情况下,我想将它们传递给另一个页面(.php文件)。

你的帮助是非常赞赏:)

代码: -Script

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> 
+1

你的代码在哪里? – DevZer0

+0

嗨DevZer0,我的问题上的链接将带你到代码。但我明白你为什么现在问这个问题......让我发布完整的代码。谢谢。 – 21stking

+0

@ 21stking它会带你到jQuery UI的代码,而不是你的 – vladkras

回答

0

这意味着你必须绑定点击你的书按钮事件:

$('#bookButton').click(function() { 
    // perfom check 
    if (bValid) { 
     // other code 
    } 
}); 
+0

我确实有我的按钮的事件处理程序,它的工作原理,问题在于将我的值发布到另一个页面。即内部if(bvalid){//其他代码} – 21stking

+0

我已经找出了问题所在。问题是我试图传递的值(name.val(),email.val()等)..当我硬编码的值工作正常,但是当我引用他们,他们不工作 – 21stking

相关问题