I have the following code setup:
var formData = new FormData();
var url = config.getValue("api.baseLocation") + config.getValue("api.upload");
formData.append("scopeInfo", JSON.stringify($scope.video));
$.ajax({
url: url,
type: "POST",
data: formData,
processData: false,
contentType: false,
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log(XMLHttpRequest);
console.log(textStatus);
console.log(errorThrown);
alert("error " + XMLHttpRequest + ' - ' + textStatus + ' - ' + errorThrown);
}
}).done(function (data) {
toast("Completed!", 4000);
window.history.back();
});
And this works great on FF, Chrome. For IE9 I had to add a fix to support the FormData ( FormDatafix )
When I click submit, on IE9 it gives me Error: Invalid argument.
I have no clue why this is happening, nor on what argument it's referring to. I tried setting the following attributes, but non of them made a difference:
cache: false
dataType: "json"
crossDomain: true
I changed the way I handle the post in the API, IE9 was perfectly able to send Json data, so in the API I processed things to support that. and now it's working like it should
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.