jquery - Ajax upload not working in Firefox and IE -


the upload work intended not in firefox. there no error msg , post set reply status of 200 ok. code stop in firefox , nothing uploaded. no response server beside status 200

edit

the post event not getting triggered php when posted firefox;

the form;

<form id="avatar_form" method="post" action="ajax-php.php" enctype="multipart/form-data"> <input id="avatarfile" type="file" name="file" size="25" class="input" value="" data-type="file"> <input id="avatarup" type="submit" value="télécharger" disabled="disabled" name="avatarup"> </form> 

after in php can catch post

if(isset($_post["avatarup"])){// deal file here} 

only in chrome. post not set when using firefox.

i have code upload files using ajax;

$(document.body).ready(function () {     $(document.body).on('submit', '#avatar_form', function (e) {         e.preventdefault(e);         var $form = $(this);         var formdata = (window.formdata) ? new formdata($form[0]) : null;         var data1 = (formdata !== null) ? formdata : $form.serialize();         alert(data1);          $.ajax({             url: $form.attr('action'),             type: $form.attr('method'),             contenttype: false,              processdata: false,              datatype: 'json',              data: data1,             success: function (response) {                 console.log(response);                 if (response == 1) {                     var item = load_content('profil_menu').then(function (response) {                         console.log("item x", response);                         data = response;                         $('#profil_menu').html(data);                         return;                     });                 }             }         });     }); }); 

the code working fine in chrome not in firexfox or ie, dont care ie should work in firefox?

so wrong post?

make ajax call synchronous setting async : false. must job.


Comments

Popular posts from this blog

java - pagination of xlsx file to XSSFworkbook using apache POI -

Unlimited choices in BASH case statement -

apache - How do I stop my index.php being run twice for every user -