简体   繁体   English

$ .Ajax在IE9上抛出“无效参数”

[英]$.Ajax throwing “Invalid argument” on IE9

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. 这在FF,Chrome上效果很好。 For IE9 I had to add a fix to support the FormData ( FormDatafix ) 对于IE9,我必须添加一个修复程序以支持FormData( FormDatafix

When I click submit, on IE9 it gives me Error: Invalid argument. 当我单击提交时,在IE9上它给我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. 我更改了我在API中处理帖子的方式,IE9完全能够发送Json数据,因此在API中我进行了处理以支持这一点。 and now it's working like it should 现在它像应该的那样工作

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM