Problem jquery calling the Pagemethod in VS2005?

Posted by Gg under ASP.NET on 5/13/2011 | Points: 10 | Views : 2916 | Status : [Member] | Replies : 1
Hi,
Is the below code will work in the .net VS 2005 ?

I tried in vs2005 but the code not calling server method ?

<script type="text/javascript" language="javascript">
$(document).ready(function () {
$('searchbox').click(function () {
alert("hi");
$.ajax({
type: "POST",
url: "Products.aspx/Results",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
// Replace the div's content with the page method's return.
$("#Result").text(msg.d);
}
});
});
});
</script>


Thanks,
gg.




Responses

Posted by: Nishithraj on: 5/13/2011 [Member] Bronze | Points: 25

Up
0
Down
Have you specified [Webmethod] attribute in the server side?
Also please compare your syntax provided in the posts

http://encosia.com/2008/05/29/using-jquery-to-directly-call-aspnet-ajax-page-methods/
http://weblogs.asp.net/karan/archive/2010/09/12/calling-server-side-method-using-jquery-ajax.aspx

Also check the threads
http://stackoverflow.com/questions/886903/calling-asp-net-server-side-method-via-jquery

Mark this as answer, if it is.....

With regards
Nishithraj Narayanan

Gg, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response