These seems to be a fairly common issue so I've stripped it down to the bare minimum to see if it's something I'm doing.
When trying to capture a form input with a file field (hence using new FormData
instead of serialize()
) I'm seeing differences between IE and firefox/chrome/safari.
add_new
is the id of the form, I've checked it's the only element with that ID on the page, so here's the issue.
In IE this works:
$(document).on("submit","#add_new",function(e){
e.preventDefault();
})
The form is not submitted, as expected. However, as soon as you add the next line, the script submits to itself.
$(document).on("submit","#add_new",function(e){
e.preventDefault();
var dat = new FormData($('#add_new')[0]);
})
This only seems to be happening in IE like I said, no issues elsewhere. I've tried putting return false
on the end too but no joy.
Any ideas?
Thanks