I am just starting to mess around with Page Methods and jQuery together with not much success.
Below is my sample code...
Default.aspx.cs
[WebMethod]
public static string test()
{
return "testing 123";
}
test.js
$(document).ready(function()
{
$("#Result").click(function()
{
$.ajax({
type: "POST",
url: "Default.aspx/test",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg)
{
alert(msg);
}
});
});
});
If I set a breakpoint at 'return "testing 123";' it never gets hit, also when I try doing http://localhost/default.aspx/test I get the whole page posted back, same with the jQuery function.
I have also tried using scriptmanager and MS AJAX PageMethods.test(); with the same exact result.