Last Updated: February 25, 2016
·
2.092K
· petermorlion

ASP.NET and jQuery submit event

ASP.NET has the concept of postbacks (for example, for LinkButtons), that can be a problem if you want to subscribe to the submit event with jQuery:

$('form').submit(function() {});

With postbacks, there is no submit event. ASP.NET has a javascript method __doPostBack that handles the calls to the server. That's why I wrote a jQuery plugin (http://plugins.jquery.com/beforePostBack/) to subscribe to the (new) beforePostBack event:

$.beforePostBack(function() {});

The plugin can be found here: https://github.com/petermorlion/jquery.beforePostBack