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

Posted 马雁飞

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了asmx 接受 ajax post,jQuery ajax request from asmx web service相关的知识,希望对你有一定的参考价值。

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.

以上是关于asmx 接受 ajax post,jQuery ajax request from asmx web service的主要内容,如果未能解决你的问题,请参考以下文章

asmx web 服务 - jQuery ajax post json (500 错误) - CORS (Access-Control-Allow-Origin 设置为 *)

从 jQuery 调用 ASMX

jquery中ajax方法load get post与脚本文件如php脚本连接时,脚本怎样接受数据?

jquery ajax post请求不接受绝对url rails应用程序

Jquery Ajax调用asmx出错问题

如何从 2.0 asmx Web 服务返回 JSON