【发布时间】:2013-03-27 20:50:39
【问题描述】:
我有以下 ajax 帖子:
$.ajax( {
type: "POST",
url: "http://192.168.7.9/api",
dataType: 'json',
data: { username: "john.doe", password: "123456", method: "search_samples" },
success: function ( data ) {
// Never get here
},
error: function ( XMLHttpRequest, textStatus, errorThrown ) {
// Always here: if async true, errorThrown has no message
// otherwise I se the NETWORK_ERR message
}
} );
返回此错误:NETWORK_ERR: XMLHttpRequest Exception 101。
我已经阅读了很多关于这个错误的 SO 帖子,大多数人建议我将 async 设置为 true。这确实删除了错误消息 - 但它仍然是一个错误,我从来没有得到有效的数据。它似乎只是删除了无用的错误消息。
在提琴手中,在同一台开发机器上,这可以完美运行 - 这是 chrome 问题吗?产地问题?我的语法有问题吗?
【问题讨论】:
-
这是一个跨域请求(即您的主应用程序不是在
http://192.168.7.9运行)吗? -
@Steve 这些机器在同一个子网上,但是 192.168.7.9 机器根本不在域中...