我正在尝试从跨域 node.js 获取带有 Sencha Touch 的 json
我的 node.js 代码:
app.get('/login', function (req, res) {
console.log("Request handler random was called.");
res.header("Access-Control-Allow-Origin", "*");
res.header("Access-Control-Allow-Headers", "X-Requested-With");
res.writeHead(200, {"Content-Type": "application/json"});
var otherArray = ["item1", "item2"];
var otherObject = { item1: "item1val", item2: "item2val" };
var json = JSON.stringify({
anObject: otherObject,
anArray: otherArray,
another: "item"
});
res.end(json);
});
这里的代码工作正常:http ://still-stream-9036.herokuapp.com/login
但是当我尝试使用 sencha touch 时,我得到了:
(failed)
Invalid HTTP status code 404