I'm trying to process a page which contains data from one form (user input fields), data from other elements on the page (options) and a JQuery variable (array). I'm trying to figure out the best way to send these to a PHP file to process.
If I link the submit button to the user input form it will send all those fields but not the variable or the user options.
If I trigger an action on the button click I can call a JQuery function which sends the variable by POST/AJAX to the PHP script.
$(document).on('click', '#submit', function(){
$.ajax({
url:"processdata.php",
type: "post",
data: {dataList: dataList},
dataType: 'text',
success:function(result){
//success
}
});
});
Is there a way to make a single click post all three sets of data at once? With three post operations I would get three separate results to the JQuery script and I'm not sure how to handle that.