php - Jquery Ajax response doesn't work on Firefox -


this response in php. can confirm datas ok.

 $ajax_response = array(     'product_code' => $ajax_products,     'filter' => $ajax_filter );  echo json_encode($ajax_response); exit(); 

here code in javascript :

$('#pr_category_filter').submit(function (event) {      $.ajax({         type: $(this).attr('method'),         url: $(this).attr('action'),         data: $(this).serialize(),         datatype: 'json',         cache: false,         success: function (data) {              if (data.product_code != null) {                 $('#pagination_contents').replacewith(data.product_code);             }              if (data.filter != null) {                 $('#category_filter').replacewith(data.filter);             }         },         error: function (request, status, error) {             return false;         }     });      event.preventdefault(event);  }); 

this code works on chrome , opera. however, code doesn't work on firefox because php "echo" displayed on firefox instead of ajax response. tried put console.debug('invoked') in javascript. no result displayed in firefox in contrary of chrome. know reason ?

the response same browsers tools development.

thanks

the function .preventdefault() not accept arguments.

probably firefox therefore not accept , submits form. chrome not care , accept it.

so change

event.preventdefault(event); 

into

event.preventdefault(); 

that should trick


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -