I am making an Ajax call:
$.ajax({
url: "create_card.php",
type: "GET",
data: {deck: selection, data: $(input_form).serialize()}
});
Initially, I was just using the array in the call, so I had data: $(input_form).serialize()
, and I was using this code to get the data from the input form (card_info
is an array of the named data in the input form):
for($x = 0; $x < $array_length; $x++) {
if(isset($_GET[$card_info[$x]])){
$arg = $_GET[$card_info[$x]];
$sql_query .= "\"" . $arg . "\"";
if($x != $array_length - 1) {
$sql_query .= ", ";
} else {
$sql_query .= ")";
}
}
}
But now that I added the extra parameter to the Ajax call, I can't seem to access the data in the same way anymore. I've tried $_GET[data[$card_info[$x]]]
but this did not work.