我試圖通過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