0
我有一个xhr请求。我正在尝试在本地服务器上测试代码。在本地服务器上测试XMLHttpRequest
GetMetaData: function() {
var xhr = new XMLHttpRequest();
xhr.open("POST", "../?/?.asmx/GetData", true);
xhr.setRequestHeader('Content-Type', 'application/json;charset=utf-8;');
xhr.send(JSON.stringify({
"args": JSON.stringify({
method: "?",
factors: "?",
lcid: app.ResponseParamsValues.lcid,
})
}));
xhr.onreadystatechange = function() {
if (this.readyState == 4) {
var response = (JSON.parse(this.responseText).d);
app.variables.metaValues = response.Result;
}
if (this.status != 200) {
console.log('error: ' + (this.status ? this.statusText : '?'));
}
};
}
我试图改变对本地服务器上的.json文件的响应。但是,这是行不通的
GetMetaData: function() {
return "../../data/data.json";
}
大的。但这不是一个问题。 – Xufox