I'm trying to call a WebService method by jQuery, but it's not working.
The code is given below...
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) code given below:
[WebMethod]
[WebInvoke(Method = "POST", ResponseFormat = WebMessageFormat.Json)]
[ScriptMethod(ResponseFormat = ResponseFormat.Json)]
public string GetSurvey()
{
return "Question: Who is Snoopy?";
}
What could be the problem?