【发布时间】:2012-02-27 17:06:48
【问题描述】:
我想使用 dojo 来使用 Restful 网络服务。 在浏览器上返回 web 服务的结果,但是当我尝试使用 xhr 获取结果时,我总是得到一个空值,所以请帮助我是 dojo 的新手...
dojo.query("li").onclick(function(){
var xhrArgs = {
url: "http://192.168.1.65:9080/RAD8JAX-RSWeb/jaxrs/customers",
handleAs: "json",
headers: { "Content-Type": "application/json"},
load: function(data) {
alert("ok");
console.log(data);
},
error: function(error) {
console.log(error);
}
};
dojo.xhrGet(xhrArgs);
console.log("message sent ...");
});
当事件发生时,会显示警报,我得到“null”
【问题讨论】:
-
您是从192.168.1.65:9080 的 HTML 页面发出请求吗?
标签: javascript json rest dojo