Passing Array via Ajax
Passing Array via Ajax
I am totally new to Javascript, JQuery, Ajax, all of it. So, apologies if this is a dumb newbie question or a common question. I tried searching but didn't find an answer I could understand.
I have been trying to figure out how to send a simple Javascript multi-dimensional array via Ajax to a PHP script on the server. I have been reading up about the JSON standard for this, and have experimented with a few JSON stringifiers, etc.
But, it seems that JSON requires a KEY->VALUE pair. What if I created a Javascript array like this:
var testarray = [["image.jpg",1024],["image2.jpg",928]];
This array is not comprised of keys -> values the way JSON is. It can be stringified, and it seems it can be passed via Ajax, but how can a PHP script access it and convert it into a useable PHP array?
I would need to also reverse the process, by sending the PHP array via Ajax to the Javascript client-side.
Any help would be appreciated.