Note that there are some explanatory texts on larger screens.

plurals
  1. POcalling aspx.cs method from javascript
    primarykey
    data
    text
    <p>I am currently trying to call a method in the aspx.cs inside of my javascript.</p> <p>Below is what i currently have:</p> <p>Javascript:</p> <pre><code>function loadPins(passValue) { callServer2("myMethod", passValue); } function callServer2(requestMethod, clientRequest) { var pageMethod = "Default.aspx/" + requestMethod; $.ajax({ type: 'POST', data: clientRequest, dataType: 'JSON', contentType: 'application/json', url: pageMethod , //Method to call success: function (result, status) { alert("success"); }, error: function (xhr, status, error) { alert("ERROR"); } }); } </code></pre> <p>My <code>aspx.cs</code>:</p> <pre><code> [WebMethod] public static string myMethod(string passedVal) { value = passedVal; return "true"; } </code></pre> <p>When I debug I see it calling and entering <code>CallServer2</code> but it never seems to hit my break point in my aspx. I dont see my sucess or error message alerts either.</p> <p>Any suggestions?</p> <p>Error I am Currently Getting:</p> <pre><code>error - &lt;html&gt; &lt;head&gt; &lt;title&gt; Unknow we method myMethod.&lt;br&gt;Parameter name: methodName&lt;/title&gt; &lt;style&gt; body{font-family:verdana";font-weight:normal;font-size: .7em;color:black} p {font-family:"Verdana";font-weightbold;color:black;margin-top: -5px} b{font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1{ font-family:"veranda";font-weight:normal;font-size:18pt;colour:red} H2{ font-family:"Verdana";font-weight:normal ;font-size:14pt color:maroon} pre{font-family:"Lucida Console";font-size .9em} .marker{font-weight:bold;color:black;text-decoration:none;} .version{color:gray;} .error{margin-bottom:10px} .expandable{text-decoration:underline, font-weight:bold; color:navy; cursor:hand;} &lt;/style&gt; &lt;head&gt; &lt;code&gt; An unhanded exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.&lt;/code&gt; ... </code></pre> <p>*<strong>Note</strong> I didnt put the ... thats really all it says after the line above</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.
 

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