Jquery,无法连接到Web服务 - 404错误 [英] Jquery, can't connect to the web service - 404 error
问题描述
我有一个带网址的网络服务:
http://www.m-hakehilot.co.il/kehila_search/kehilot/retrieve.json [ ^ ]
当我在SoapUI软件中测试它时,它似乎工作得很好。
在SoapUI中我将服务类型配置为REST,并将方法配置为POST。
之后,我尝试在ajax代码中使用它,但是我得到了404(未找到)错误。
我的ajax代码:
Hi,
I have a web service with the url:
http://www.m-hakehilot.co.il/kehila_search/kehilot/retrieve.json[^]
When I tested it in the SoapUI foftware, it seem to work well.
In the SoapUI I configured the service type to REST, and the method to POST.
After it, I tried to use it in ajax code, but I got the 404 (not found) error.
My ajax code:
$.ajax({
url: "http://www.m-hakehilot.co.il/kehila_search/kehilot/retrieve.json",
type: 'post',
dataType: 'json',
error: function (XMLHttpRequest, textStatus, errorThrown) {
console.log('get kehilot - error details:');
console.log('XMLHttpRequest: ' + JSON.stringify(XMLHttpRequest));
console.log('textStatus: ' + JSON.stringify(textStatus));
console.log('errorThrown: ' + JSON.stringify(errorThrown));
return [];
},
success: function (data) {
//DO SOMETHING
}
});
任何帮助?
提前致谢!
我尝试了什么:
我尝试了很多选择:
发送数据,更改网址,但没有成功。
Any help?
Thanks in advance!
What I have tried:
I tried a lot of options:
Send data, change the url, but no succeeded.
推荐答案
.ajax({
url: http://www.m-hakehilot.co.il/kehila_search/kehilot/retrieve.json,
类型:' post',
dataType:' json',
错误: function (XMLHttpRequest,textStatus ,errorThrown){
console .log(' 获取kehilot - 错误详情:');
console .log(' XMLHttpRequest:' + JSON .stringify(XMLHttpRequest));
console .log(' textStatus:' + JSON .stringify(textStatus));
console .log(' errorThrown:' + JSON .stringify(errorThrown));
return [];
},
成功:功能(数据){
// DO SOMETHING
}
});
.ajax({ url: "http://www.m-hakehilot.co.il/kehila_search/kehilot/retrieve.json", type: 'post', dataType: 'json', error: function (XMLHttpRequest, textStatus, errorThrown) { console.log('get kehilot - error details:'); console.log('XMLHttpRequest: ' + JSON.stringify(XMLHttpRequest)); console.log('textStatus: ' + JSON.stringify(textStatus)); console.log('errorThrown: ' + JSON.stringify(errorThrown)); return []; }, success: function (data) { //DO SOMETHING } });
任何帮助?
提前致谢!
我尝试了什么:
我尝试了很多选择:
发送数据,更改网址,但没有成功。
Any help?
Thanks in advance!
What I have tried:
I tried a lot of options:
Send data, change the url, but no succeeded.
问题是服务器中的CORS设置错误。
The problem was wrong CORS settings in the server.
这篇关于Jquery,无法连接到Web服务 - 404错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!