Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>As i understand the question, you are talking about 2 very different things. the .ASPX page is rendered on the server and the javascript code is rendered at the client side.</p> <p>for you to call a function from the aspx page from JS means that you need to make a call to the server to render your page is some other manner with a parameter you mentioned in your call.</p> <p>only then will the server re-render the page (can be ajax as well) and invoke these methods.</p> <p>other then that, the server side code is not being sent to the client side.</p> <p><strong>On the client side:</strong></p> <p>you can use any framework or implement your own. i'll use jquery for simplicity</p> <blockquote> <pre><code>/* attach a submit handler to the form */ $("#form_name").submit(function(event) { /* stop form from submitting normally */ event.preventDefault(); </code></pre> </blockquote> <pre><code>/* get some values from elements on the page: */ url ="&lt;server url&gt;"; var $inputs = $('#form_name :input'); var dataString=""; $inputs.each(function() { if (this.type != "submit" &amp;&amp; this.type != "button") dataString += (this.name +"="+ $(this).val() +"&amp;").trim(); }); /*Remove the &amp; at the end of the string*/ dataString = dataString.slice(0, -1); /* Send the data using post and put the results in a div */ $.post( url, dataString, function( data ) { } ); </code></pre> <p>the serialize function will work as well just add its output instead of the dataString.</p>
 

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