I am trying to use page methods in my asp.net page. I have enable page methods set to true on the script manager, the webmethod attribute defined on the method, the function is public static string, I know the function works because when I run it from my code behind it generates the expected result, but when I call it via page method in my result function the result is always alerted as undefined. If I use fiddler it doesn't even look like there is additional traffic or a new request created. I'm running the site on port 82 if that makes a difference. I'm at a loss here. Can someone give me some pointers?
2 Answers
OK, stupid me. Here is some code.
function getName()
{
var ddlAdCodes=$get('<%=ddlAdCodes.ClientID %>');
var value=ddlAdCodes.options[ddlAdCodes.selectedIndex].value;
//alert(value);
PageMethods.getAdCodeInfo(value,onSuccess(),onError());
}
function onSuccess(result)
{
alert(result);
}
function onError(error)
{
alert("error "+error);
}
1 Comment
Kon
Next time hit the "Code Sample" button (101010) to format it nicely and make it easier to read.