Hello everyone. I'm trying to submit a form via AJAX that contains a "file" input (upload) and have cross-browser support (including IE8). I have tried using a polyfill for the FormData object, but even with that, IE8 cannot send the form properly to my endpoint.
I found this plugin (jQuery.form) and decided I would give it a try. It seems to work except that in IE8, it throws an error and asks the user if they would like to debug. I am using the plugin the following way:
- $('#import-form').ajaxSubmit({
- url: window.homeUrl + 'ajax.py',
- type: 'POST',
- data: {action: 'importMappings'},
- dataType: 'json',
- success: submitResults
- });
I have a button with a click handler that calls a function to execute this code. The error I get is (in the minified version of the code:
- Line: 11
- Error: Object doesn't support this property or method
The highlighted portion of the plugin when I click to debug is:
- if(u&&!/MSIE [678]/.test(navigator.userAgent)&&(u=e(u).get()),s&&(i=e(':input[form="'+s+'"]').get(),i.length&&(u=(u||[]).concat(i))),!u||!u.length)
Any idea why I'm getting this error and how to fix it? I'm open to using other methods of of form submission.