P
P
Pavel2016-03-17 11:14:55
JavaScript
Pavel, 2016-03-17 11:14:55

Why is the form not submitting in firefox?

Good afternoon. The wonderful firefox browser does not submit the form via ajax. Instead, the page is simply refreshed. Here is the code

$(document).ready(function(){ 
                              $("#zayava").submit(function() {
                    event.preventDefault();
                    var form_data = $(this).serialize(); 
                    $.ajax({
                    type: "POST", 
                    url: "<?php echo get_template_directory_uri();?>/ufpdf/action-form.php",
                    data: form_data,
                    success: function() {
                         $('.success').fadeIn();
                         },
                    error: function() {
                         $('.error').fadeIn();
                         }
                    });	
                });
          });

In opera and chrome everything works as it should.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
W
Wheelie, 2016-03-17
@Palych_tw

you have event.preventDefault();but no event is passed.
It's easiest on submit return false; prescribe.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question