i trying add item end of array, kind of arraylist. tried using .push() can't working correctly reading xml. how "auto" update array in jquery? (append end of if want think of way)
here jquery looks @ moment.
images = new array(); $.ajax({ type: "get", url: strxmlurl, datatype: "xml", success: function(xml) { $(xml).find("image").each(function() { images.push($(this).attr("src")); }); }, error: function() { alert("error reading xml"); } });
xml
<?xml version="1.0" encoding="utf-8" ?> <gallery> <image src="images/gallery/gallery1.jpg"/> </gallery>
if need more information, i'll happily provide more.
declare images array inside success function of ajax call ensure scope remains correct function should work...
Comments
Post a Comment