Jquery.form.js not working in Internet Explorer 9

I have a simple form with file upload control. The form will be submitted after clicking the upload button. I am trying to make a jquery-ajax post using jquery.form.js .

My code is as follows:

 var options = { beforeSubmit: function (formData, jqForm, options) { $(".loaderImage").show(); return true; }, success: function (responseText, statusText, xhr, $form) { $("#result").html(responseText); }, error: function(xhr) { alert(xhr.responseText); } }; $("#AjaxFileUpload").ajaxSubmit(options); return false; 

It works great in Google Chrome , Firefox, and Internet Explorer 10 . The problem with Internet Explorer 9 after debugging does not introduce success() . Any indication of what's going wrong? There are also no errors in the console.

I added the error parameter, but the problem is the same, the breakpoint does not fall into the warning.

I just looked at network traffic. When I click the Download button, there is no POST request (in Internet Explorer 9), but there is a POST request in Internet Explorer 10.

I also cleared the cache settings and reset. But the problem persists.

+4
source share
3 answers

badZoke, Yesterday I ran into the same problem for most of today, and finally realized what was causing it (in my case). This may be useful for your situation:

Internet Explorer has restrictions on submitting a form when the form is not in the DOM. In my case, the user interacted with a button in a modal popup (which also contained a form). When they clicked, the form was removed from the DOM (but still accessible through js var) and the loading bar was replaced. Then I called myForm.ajaxSubmit(options); which in IE <10 is trying to pass this form to a temporary <iframe/> . Not allowed if the form is not in the DOM.

If your code above was a simplification of your actual script and you were doing something similar to me, this might be your problem. Good luck.

+1
source

The first step is to see if the error callback is called:

 var options = { beforeSubmit: function (formData, jqForm, options) { $(".loaderImage").show(); return true; }, success: function (responseText, statusText, xhr, $form) { $("#result").html(responseText); }, error: function(xhr) { alert(xhr.responseText); } }; $("#AjaxFileUpload").ajaxSubmit(options); 
0
source

Your code works fine on my computer, and I'm using Internet Explorer 9. Perhaps there is no problem here.

0
source

Source: https://habr.com/ru/post/1479304/


All Articles