0

何度も試し、多くのフォーラムにアクセスしましたが、答えが見つかりませんでした。他の投稿と同様に投稿しないでください。これを修正するのを手伝ってください。

HTML フォーム:

<form action="" method="post" id="bookingForm">
<div id="radiobutton">
<input type="radio" name="trip" id="oneway" value="oneway" checked/>&nbsp;Oneway
<input type="radio" name="trip" id="return" value="return"/>&nbsp;Return
</div>
<br/>

From:<input id="boarding" type="text" maxlength="40" class="user_input" size="18" name="boarding" value="Hyderabad"/>
To:<input id="landing" type="text" maxlength="40" class="user_input" size="18" name="landing"/>
<br/><br/><br/>

Onward:<input id="datepick"  name="onward" class="user_input" size="15" />

Return: <input id="datepick2"  name="return" class="user_input" size="15" />
<br/><br/><br/>
Your Name:<input id="pax_name" type="text" name="pax_name"  class="user_input" size="25" maxlength="50"/>
<br/><br/>
Contact number:<input id="pax_contact" type="text" maxlength="14" name="pax_contact" class="user_input" size="25"/>
<br/><br/>
Email:<input id="pax_email" name="pax_email" class="user_input" size="25"/>
<br/><br/>
<center>

<input id="submit" type="button" value="Request" />

メールを送信するための process.php:

<?php

  $trip=$_POST['trip'];
  $boarding=$_POST['boarding'];
  $landing=$_POST['landing'];
  $onward=$_POST['onward'];
  $return=$_POST['return'];
  $pax_name=$_POST['pax_name'];
  $pax_contact=$_POST['pax_contact'];
  $pax_email=$_POST['pax_email'];

        $to='anvesh@bsbtravels.com,anvifriend@gmail.com';
        $subject='Booking Form Query';
        $body=
              'Name: '.$pax_name."\n".
              'Contact Number: '.$pax_contact."\n".
              'Trip: '.$trip."\n".
              'From: '.$boarding."\n".
              'To: '.$landing."\n".
              'Onward Date: '.$onward."\n".
              'Return Date: '.$return."\n";
        $headers='From: '.$pax_name.'<'.$pax_email.'>';
        mail($to,$subject, $body, $headers)

?>

Jクエリコード:

$(document).ready(function(){
$('#submit').click(function(){
          var boarding=$('#boarding').val();
          var landing=$('#landing').val();
          var datepick=$('#datepick').val();
          var datepick2=$('#datepick2').val();
          var pax_name=$('#pax_name').val();
          var pax_contact=$('#pax_contact').val();
          var pax_email=$('#pax_email').val();


    if($('#landing').val().length<3 || $('#boarding').val().length<3 || $('#datepick').val().length<3 || $('#pax_name').val().length<3 || $('#pax_contact').val().length<8 || $('#pax_email').val().length<3){

        $('#bookfail').attr('title','Sending Failed!').text('Please Enter valid information. All fields are required').dialog({buttons:{'Ok':function(){
            $(this).dialog('close');
            }},closeOnEscape:true,draggable:false,resizable:false,modal:true});

    }else{
                var VarData='boarding='+boarding+'&landing='+landing+'&datepick='+datepick+'&datepick2='+datepick2+'&pax_name='+pax_name+'&pax_contact='+pax_contact+'&pax_email='+pax_email;
        $.ajax({
           type:'POST',
           url:'process.php',
                   data:VarData,
           success:function(){
           $('#booksuccess').attr('title','Request sent successfully').text('Your request has been sent. We will be in touch soon').dialog({buttons:{'Ok':function(){   $(this).dialog('close');
            }},closeOnEscape:true,draggable:false,resizable:false,modal:true});
           }
           error:function(){
                alert('Oops request sending failed. Please try again');
           }
        });
        }
    });
});
4

2 に答える 2

1

コールバックの後にカンマがありませんsuccess:

success:function(){
   ...
}
error:function(){
   ...
}

である必要があります

success:function(){
   ...
},// <--
error:function(){
   ...
}
于 2013-02-04T09:55:06.293 に答える