parsererror in ajax jquery calling a webservice
I have written a webservice like below:
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Json, XmlSerializeString = false, UseHttpGet = true)]
public string GetNews(int tes)
{
return tes.ToString();
}
and I want to use this function in client so I wrote this lines:
$.ajax({
dataType
: "jsonp",
success
: function (d) {
$
('.widget.yellow').html(d.d);
},
error
: function (xhr, textStatus, errorThrown) {
$
('.widget.yellow').html(textStatus);
},
data
: { tes: '170' },
url
: "http://localhost:1122/Services/MyService.asmx/GetNews?format=json"
});
but I get error.The textStatus is "parsererror" and xhr.statusText is "success" and xhr.status is "200" and xhr.readyState is "4". I need some help.