Posted By

nighthawk on 11/17/08


Tagged

ajax jquery


Versions (?)

Who likes this?

9 people have marked this snippet as a favorite

benrudolph
umang_nine
Hollow
nreliu
brainwaves
seanpowell
jillella
ringo380
Priestd09


jQuery Submit Form with Ajax


 / Published in: JavaScript
 

URL: http://railscasts.com/episodes/136-jquery

Adapted from Railscasts

Use like $("myElement").submitWithAjax() to add unobtrusive submission via Ajax to your forms.

  1. jQuery.fn.submitWithAjax = function() {
  2. this.submit(function() {
  3. $.post(this.action, $(this).serialize(), null, "script");
  4. return false;
  5. });
  6. return this;
  7. };

Report this snippet  

You need to login to post a comment.