我已经设置了一个运行本地Web服务器(用ExtJs编写)的Apache服务器。我也phantom.js提出并监听8080端口塞康本地服务器:Ajax从本地js脚本调用本地Phantom.js服务器
var server, service;
server = require('webserver').create();
service = server.listen(8080, function (request, response) {
response.statusCode = 200;
response.write('<html><body>Hello!</body></html>');
response.close();
});
现在我想从做我的应用程序到仿真服务器的Ajax请求:
Ext.Ajax.request({
url: 'http://localhost:8080',
method: 'GET',
success: function(response){
console.log('RESPONSE: ', response);
},
filure: function(response){
console.log('failure: ', response);
}
});
但是当运行这个脚本时,我得到:
"NetworkError: 400 Bad Request - http://localhost:8080/?_dc=1336648497292"
在控制台中。此操作是否违反相同的原产地规定?或者是别的什么 ?去localhost:8080显示正确的响应,所以服务器正常运行。
不同的端口将是一个与原点不同的域。 –
*此操作是否违反相同的原产地规定?*是*或者是其他内容?*是的。服务器正在报告400错误请求错误。 – Quentin
确定'错误请求'错误是否来自跨域问题? –