jquertil, I am the least qualified person to answer you, but am
disappointed that you haven't received any replies to either of your
posts, so am bumping you up!

I have this difficulty all the time -- and you're clearly more
advanced than me. I *think* you need to create a namespace - which I
**think** means naming your function. If there is any simple
documentation about this, I haven't found it yet!

Good luck - and, if you don't get a reply but find the answer anyway,
please post it back!!

Cherry :)

On Feb 16, 1:35 am, jquertil <[EMAIL PROTECTED]> wrote:
> I know little about variable scope, have been reading up on OOP, but I
> don't understand why this would not work.
> I tried inserting "return objectArray" in various places to no
> avail...
>
> $('#button1').click(function(b){
>     $().loadXML2array('url','var');
>     alert(objectArray);               // does not work
>
> });
>
> jQuery.fn.extend({
>     loadXML2array: function(url,variable) {
>         return this.each(function() {
>             $.get(url,{xml:variable}, function(data){
>                  objectArray = new Array();
>                  $(data).find('row').each(function(i){
>                      rowObj = new Object();
>                      rowObj.col1 = $(this).children('col_1').text();
>                      rowObj.col2 = $(this).children('col_2').text();
>                      rowObj.col3 = $(this).children('col_3').text();
>                      objectArray.push(rowObj);
>                 });
>             });
>         });
>     }
>
> });

Reply via email to