Reputation: 1
My XML looks like this:
<photo>photo1.jpg</photo>
<photo>photo2.jpg</photo>
I can get the value of each photo node by doing something like:
var myPhoto = $(this).find('photo').text();
I'm trying to get an array of nodes like so:
myPhotoArray.push(myPhoto);
When I push this to an array how do I add a comma separator for each node? It prints all the node values out on one line (photo1.jpgphoto2.jpg) Thank you!
Upvotes: 0
Views: 540
Reputation: 60414
Use join
when you output:
myPhotoArray.join(",");
Actually, the comma is the default separator, so you could leave it out:
myPhotoArray.join();
Upvotes: 1