asmx 接受 ajax post,jQuery ajax request from asmx web service

博主尝试使用jQuery的ajax从http://data.niassembly.gov.uk/organisations.asmx/GetPartiesListCurrent_JSON获取JSON数据,但请求失败。已确认本地JSON文件正常工作,目标服务有GET选项,问题可能在于POST请求设置或服务本身。
摘要由CSDN通过智能技术生成

I'm attempting a request data from a HTTP POST asmx web service with jQuery's ajax. I've read numerous guides on how to do this correctly but with no success. From what I can determine, it is the request itself that is failing:

$.ajax({

type: 'POST',

url: "http://data.niassembly.gov.uk/organisations.asmx/GetPartiesListCurrent_JSON",

contentType: 'application/json; charset=utf-8',

data: JSON.stringify({}),

dataType: 'json',

success: function(data){

if (data.hasOwnProperty('d')){

msg = data.d;

} else {

msg = data;

}

alert(msg);

}

,

error:function(){

alert('error');

}

});

The JSON formatting is correct and when I save the content as a local .json file the function works. The service also has a GET option but from what I've read that won't work in this case.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值