Note that there are some explanatory texts on larger screens.

plurals
  1. PO2 page methods on an aspx page
    primarykey
    data
    text
    <p>I'm calling a page method with jquery and it works just fine. I'm creating a second one and it's not working at all; all I get is the error function. Is it possible to put more than 1 page method in an aspx page?</p> <p>Here's my jquery on the client:</p> <pre><code>function LoadCount() { var TheObject = $.toJSON(CurrentForm); var TheParameter = "{'TheParameter' : '" + TheObject + "'}"; $('#testobj').html("loading"); $.ajax({ type: "POST", url: "../Pages/MyPage.aspx/GetCount", data: TheParameter, contentType: "application/json; charset=utf-8", dataType: "json", success: successFn, error: errorFn }); }; function successFn(thedata) { $('#result').html(thedata.d); }; function errorFn() { alert("problem getting count"); }; function LoadData() { var ConfirmLoad = "test"; $.ajax({ type: "POST", url: "../Pages/MyPage.aspx/GetLoaded", data: ConfirmLoad, contentType: "application/json; charset=utf-8", dataType: "json", success: successLoad, error: errorLoad }); }; function successLoad(thedata) { alert((thedata.d)); }; function errorLoad() { alert("problem getting loaded"); }; </code></pre> <p>And on the server side, I have this:</p> <pre><code>[WebMethod] public static string GetCount(string TheParameter) { // some code return JsonResult; } [WebMethod] public static string GetLoaded(string ConfirmLoad) { return "test string"; } </code></pre> <p>LoadCount and GetCount work great, I thought I'd copy the implementation to create another page method but the second time, nothing good happens. Thanks for your suggestions.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload