adding a javascript array to the post variables
I am catching a submit in jquery, performing a check and submitting the form if the check passes. If the check passes, I would also like attach a javascript array I have created to the post variables that get sent to the PHP page. Here is the code I have so far. All I am missing is attaching the array.
- $('form').submit(function(e) {
var barcodes = new Array();
$('.highlighted').each(function(i, obj) {
var barcode = $(':nth-child(2)', $(this)).html();
barcodes.push(barcode);
});
if(barcodes.length !== 0) {
console.log('barcodes is not empty!');
- // attach barcodes to post array
return true;
} else {
return false;
}
});
Thanks
Mike