Using query ajax to call a webmethod in an ASP.NET page works well if the HTTP request is a POST. If a HTTP GET request is used the Page_Load event runs instead of the webmethod. Any ideas?
Here is the Ajax
$.ajax({
type: "GET",
url: "http://local.proleaguesports.pagefad.com/AjaxTesting.aspx/receivermethod",
data: "{'test':'MyName'}",
contentType: "application/json",
dataType: "json",
success: mycallback,
error: handler
});
AND here is the code behind in C#
public partial class AjaxTesting : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
Response.Write("Page_Load runs instead of the receivermethod below");
}
[WebMethod]
[ScriptMethod(UseHttpGet = true)]
public static string receivermethod()
{
return "test received";
}
}