Dojo调用WebService不通如何解决

lxiaor98 2015-05-06 07:59:14
使用Dojo调用WebService的时候一直显示unable to load,但是直接访问WebService的时候是可以的
下面是dojo代码
 require(["dojo/dom", "dojo/on", "dojo/request", "dojo/domReady!"],
function(dom, on, request){
// Results will be displayed in resultDiv
var resultDiv = dom.byId("resultDiv");

// Attach the onclick event handler to the textButton
on(dom.byId('textButton'), "click", function(evt){
// Request the text file
request.get("http://192.168.1.76:8080/distprivilege/services/userservice/helloWorldByUser", {
data: {
userName:'Test'
}
}).then(
function(response){
// Display the text file content
resultDiv.innerHTML = "<pre>"+response+"</pre>";
},
function(error){
// Display the error returned
resultDiv.innerHTML = "<div class=\"error\">"+error+"<div>";
});
});

}
);

这个是webservice地址http://192.168.1.88:8082/distprivilege/services/userservice/helloWorldByUser?userName=xiaosong
下面是访问结果
...全文
588 2 打赏 收藏 转发到动态 举报
写回复
用AI写文章
2 条回复
切换为时间正序
请发表友善的回复…
发表回复
eHuaTian 2018-01-02
  • 打赏
  • 举报
回复
我也遇到这个问题,请问你是如何解决的?如果解决了,能不能提供一个简单的样例?麻烦你了
Go 旅城通票 2015-05-08
  • 打赏
  • 举报
回复
发送请求的url地址域名部分是否和http://192.168.1.88:8082一样,不是跨域无法访问,建议改成jsonp数据格式,自己了解什么是jsonp

52,797

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Ajax
社区管理员
  • Ajax
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧