Home | About | Apps | Github | Rss

Submit Ajax Form including Button Name

When submitting an ajax from, form.serialize() does not include the clicked button. We need to manually append this from the originalEvent attribute

$("form").on("submit", function(event)) {
    var data = $(this).serialize();
    if(event.originalEvent.submitter) {
        data = s['name'] + "=" + s['value'] + "&" + data
    }
    // continue
}

More posts