I am trying my best to learn AJAX and passing these php variables through to another php file. I am struggling though with some code.
Here is my problem. I have a button when onClick that does a javascript function
<input type='image' src='images/download-all.png' alt='Submit' onclick='download(".$y['imageURL'].")'>
The $y['imageURL'] is from code that pulls in results from a table.
$sql1 = "SELECT * FROM digital_materials WHERE id = '".$x['itemID']."'";
$res1 = mysql_query($sql1);
$y = mysql_fetch_assoc($res1);
Because I am running a while loop before hand I get two arrays back, that both have imageURL keys. I am partially using someone else's code here, so if there is something just point it out.
Here is my download function.
function download(x)
{
$.ajax({
url:'download.php',
data:"image="+x,
success:function(e){
alert("Hey, this worked.");
},
error:function(e, f, g){
alert("Error removing from cart, please try again. "+e+" : "+f+" : "+g);
}
});
}
How do I pass both of these keys from the array to my php file to be processed? Right now it is just giving me this on my source code.