thanks cherry for bumping this!

and THANKS MIKE for pointing out the async aspect of $.get()

I rewrote my function and now it works!
For the benefit of others, there are soem add'l comments

loadXML2array: function(url,variable) { // is an extension function,
see original post above
        return this.each(function() { // a weird jquery thing - you
gotta iterate through the object and it will return the variable below
            var data = $.ajax({ // cannot use get because it doesnt
allow async:false - see mike's answer above
                          type: "GET",
                          url: "echo.php?xml=datatable1",
                          async: false, // important -- if this is true, the 
return value
will be undefined. see mikes post above
                          success: function(xml) {
                                 objectArray = new Array(); // im setting up an 
array to hold
objects in
                                 $(xml).find('row').each(function(i){ // im 
looking for specific
tags
                                         rowObj = new Object(); // making an 
object
                                         rowObj.col1 = 
$(this).children('col_1').text(); // adding some
attributes to the object
                                         rowObj.col2 = 
$(this).children('col_2').text();
                                         rowObj.col3 = 
$(this).children('col_3').text();
                                         objectArray.push(rowObj); // storing 
object in the array
                                });
                          }  // nomally I would put "return objectArray" here 
but the
"return this.each()..." business above takes care of it. I dont know
why
                        })
        });
    }

Reply via email to