Apologies if this explanation isn\'t clear, it\'s hard for me to understand too. How can I use PHP & Ajax to send an array to Javascript? I\'m using Aja
Try:
$.ajax({
url: "",
type: 'POST',
data: form_data,
dataType:"json",
success: function(data) {
alert(data[0]);
}
On the PHP side, you'll be wanting to print:
print json_encode($photos);
Another thing you might try in order to better encapsulate your code, and as an example of further JSON gooodness, would be:
print json_encode(array("photolist"=>$photos,"photo_owner"=>"Me!"));
Then on the server, you'd access these with:
data.photolist[0]; //First photo
data.photo_owner; //The owner of the photo set