I am using the following to submit a form on button click. I need to attach an array named 'selected' to this post as well. I cannot use ajax for this because there will be a download happening on the posting page. I need this array to process the file to be downloaded.
I did some searching and came upon this, but was not able to get it working either :
var input = $("<input>").attr({"type":"hidden","name":"selected"}).val(selected);
$('#test').append(input);
Current :
var selected = [1,2,54,56,23]; // could be anything
$('#test').submit(function(event) {
if (selected.length > 0)
{
$('#test').attr('action','/process/p_screenshots_download2.php');
$('#test').attr('type','post');
return;
}
event.preventDefault();
});