I want to pass arrays and other variables from jquery code to php using post request but I don't know how to pass arrays and variables at the same time.
I tried this code:
var new_location_name = "";
var new_location_id = "";
var old_location_name = [];
var selected_name = [];
var selected_id = [];
var user = '<?php echo $current_user ;?>';
$(document).ready(
$("#transfer").click(function(){
$.ajax({
type: "POST",
url: "update.php",
data: "username="+user+"&new_location_name="+new_location_name+"&new_location_id"+new_location_id+"&"+{ old_location_name : old_location_name }+"&"+{ selected_name : selected_name }+"&"+{ selected_id : selected_id },
});
return false;
});
});