Home | About | Apps | Rss

Submit Ajax Form including Button Name

12 Apr 2021


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
}

Left Shift with Float Conversion in Go! | | Golang Basic Auth