Javascript Postback


Sponsored Links

73058_New Scooba® 230 Floor Washing Robot + Free Shipping!

 

Javascript Postback | Submit Form | Submit Page

Here we look at how to perform a Javascript Postback / submit the form / submit the page.

Although ASP.NET usually handles doing a postback (submitting the page/form) automatically for us, there can be times when we would like to initiate a postback ouurselves using Javascript code running on the client's browser. For instance you may be runnning a Javascript function which performs some logic, and at some point you to post back to the server so your C# can continue the processing.

Here is some Javascript code which will perform a postback of the form.


// submits form/causes postback
document.forms[0].submit();

This will cause a postback to the server.