我试图通过jQuery调用WebService方法,但它不工作。通过jQuery调用WebService方法
下面的代码是给...
jQuery的
$.ajax({
type: "POST",
data: "{}",
dataType: "json",
url:'test.asmx/GetSurvey',
contentType:"application/json;charset=utf-8",
success: function(data) {
$("#Span1").html(data.d);
}
});
test.asmx如下(WebService的)代码:
[WebMethod]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetSurvey()
{
return "Question: Who is Snoopy?";
}
可能是什么问题呢?
用于检查您的服务response.its帮助你 – 2013-04-26 06:57:38
我怎么能添加console.log(数据) – 2013-04-26 07:57:38