[wd_asp elements=’search’ ratio=’100%’ id=1]

Send – Serialize form and send extra variables

25th March 2021

Jquery - Forms-Posting

jquery icon

If you have many form fields, don’t collect them all individually, do it in one go using the Serialize function.

Remember to add the forms id

var data = $('#myform').serializeArray();
data.push({name: 'idnumber', value: idnumber});

$.post("page.php", data);

Basic Version

var formdata = $("#myformaddjob").serialize();
alert(formdata);

$.post("submitjobtodb.php", $("#myformaddjob").serialize(),
function(data) {
alert(data);
}
);

To collect posted fields in PHP use this script.