Programming Languages Hacks

Importanti regole per linguaggi di programmazione rilevanti come Java, C, C++, C#…

  • Subscribe

  • Lettori

    I miei lettori abituali

  • Twitter

Archive for April, 2011

jQuery: HTTP POST with specific <input type=”submit”>

Posted by Ricibald on 19th April 2011

jQuery allows only to do a global form submit using


This method doesn’t allow to do a specific form submit when multiple <input type=”submit”> exists, like in many ASP.NET sites, where there are a single form with many buttons.

To achieve this and obtain an ASP.NET POSTBACK behavior simply use this snippet of jQuery code that builds a “submit simulation from input”:

// simulate submit from button "myButton"
var input = $("<input>").attr("type", "hidden").attr("name", $('#myButton').attr("name")).val("");

Posted in .net, javascript, jQuery | No Comments »