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 に答える