J'ai une petite forme de web qui montre le style de shadowbox. Le formulaire est ensuite soumis et l'information est envoyée via ajax. Cela fonctionne un régal dans Firefox, cependant dans Safari, en appuyant sur soumettre il ferme la boîte de l'ombre et semble simplement soumettre le formulaire (pas ajax).Pourquoi cela fonctionne-t-il dans Firefox mais pas dans Safari?
Le code HTML du bouton et d'autres choses ...
<div id="booking_box_header"></div>
<div id="booking_box_content">
<div id="booking_box_left">
</div>
<div id="booking_box_right_container">
<form id="booking_form_1" method="post">
<input name="event_id" value="4" type="hidden">
<input name="time_id" value="18" type="hidden">
<input name="booking_email" value="[email protected]" type="hidden">
<div id="booking_box_right">
<input name="booking_name" type="text">
<input name="booking_mobile" type="text">
<div id="ticket_select">
<select name="booking_state" id="booking_state"></select>
// the submit button
<input id="next" value="Next" type="submit">
</div>
</div>
</form>
</div>
Le code Jquery pertinente est la suivante:
$('#booking_form_1').submit(function() {
var booking_email = $('input[name=booking_email]').val();
var event_id = $('input[name=event_id]').val();
var time_id = $('input[name=time_id]').val();
// bring up the loading
$('#booking_box_content').html(loader_img);
// submit the data to the booking form again
$.ajax({
type: 'POST',
url: 'process.php',
cache: false,
data: 'booking_step=1&event_id='+event_id+'&time_id='+time_id+'&booking_email='+booking_email+'',
success: function(data) {
$('#booking_box_content').html(data);
}
});
});
Je me demande si safari doesn Je n'aime pas relier la fonction de soumission car elle semble fonctionner comme si je n'écrivais aucun code JS ... que pensez-vous?
Je pense que vous avez raison! – willdanceforfun