i m using jquery ajax to get data from an asp.net back end method like this:
$.ajax({
cache: false,
type: "POST",
url: '<%= Page.ResolveUrl("~/Live/Live.aspx/GetViews") %>',
content: "json",
contentType: "application/json; charset=utf-8",
data: "{ 'Altid' : '" + GetAltId() + "' }",
success: function (msg) {
$("#backEndCount").text(msg.d);
},
fail: function (msg) {
$("#backEndCount").text(msg.d);
}
});
and the back end method:
[WebMethod]
public static string GetViews(int Altid)
{
return Live.count(Altid);
}
this call works fine locally, but on the remote service i get the page html as a response instead of the normal response which is the “d”.
what is the problem, thanks.
You have to check two main things:
'<%= Page.ResolveUrl("~/Live/Live.aspx/GetViews") %>'is correct online (try the full path for testing)