在这里,我通过 jquery ajax 调用传递了一个 http 请求标头值。它仅适用于 IE,不适用于 Firefox。当 xhr.setRequestHeader
代码中有ajax 调用本身时,Firefox 中不会发生
var Call = function () {
$.support.cors = true;
var input = {
RefId: "111", LoginId: "222", Id: "33", FirstName: "aaa", LastName: "bbb"
};
var url = document.URL;
$.ajax({
type: "POST",
beforeSend: function (xhr) {
xhr.setRequestHeader("URL", url);
},
url: "http://localhost:40780/Service.svc/Insertion",
data: JSON.stringify(Input),
contentType: "application/json",
dataType: "json",
success: function (response) {
alert(response);
},
error: function (xhr, status, error) {
}
});
}
有什么建议吗?