I am making an AJAX call in my ASP.NET application via Jquery to a page method.
$.ajax({
type: "POST",
url: "APage.aspx/GetDropDowns",
data: "{'AId':'1'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
alert(msg.d);
},
error: function() {
alert('Error ');
}
[System.Web.Services.WebMethod]
public static string GetDropDowns(string Id)
{
return "Id was: " + Id;
}
I remember from using ASP.NET AJAX that the use of webservices was encouraged as opposed to page methods. However if I am enforcing JSON as above and doing a post is there A) any security flaw with the above and B) any reason to use a webservice rather than the page method