Sunday May 18, 2014
In building ajax driven apps, one of the things that you have to do is capture form submits, send them to the server, and then handle the results. In many applications, the results are data, passed as JSON or XML or some other format that the remote service provides. In other apps, we’re dealing with snippets of HTML that then get placed in the current page somewhere. I want to be able to handle all forms on the pages, without needing to know in advance how many forms there are, what they are called, what’s in them, or what to do with the results. I haven’t found a good succinct description of how to do this, so here’s mine using jQuery. This isn’t rocket science. Its just pulling together some of jQuery’s nice features. There are other good ways to do this.