Calling c# method into jquery ajax
Hi,I am calling a c# method using jquery ajax
My c# method is in .aspx.cs page
[WebMethod]
[ScriptMethod(ResponseFormat = ResponseFormat.Xml)]
public List<ENITYT_SUPPLY.clsDemandDetails> DemandDetails()
{
/////////////////
}
my ajax script in aspx page is
$.ajax
({
type: "POST",
url: "TMSGeoLocator.aspx/DemandDetails",
dataType: "xml",
async: true,
success: function (data) {
demandMap = $(data);
},
error: function (xhr, status, err) {
var err = eval("(" + xhr.responseText + ")");
alert(err.Message);
},
async: false
});
The same c# method if i call using webservices(.asmx) its firing the method. if i use in .aspx.cs page its not working can anyone tell me the reason.