views:

33

answers:

1

Given the following lines of code which is using JQTOUCH:

$('#customers').bind('pageAnimationEnd', function(e, info){
    if (!$(this).data('loaded')) {                     
        $('.loadingscreen').css({'display':'block'});
        $(this).append($('<div> </div>').        
            load('/mobile/ajax/customers/ .info', function() {        
                $(this).parent().data('loaded', true); 
                $('.loadingscreen').css({'display':'none'});
            }));
    }
});

How can I get ride of the .append($(' '). It used to be append($('loading') but I didn't need that and now it seems like a waste of processing time to have in the function.

Is it possible?

+3  A: 
 $(this).append($('<div> </div>').        
            load('/mobile/ajax/customers/ .info', function() {        
                $(this).parent().data('loaded', true); 
                $('.loadingscreen').css({'display':'none'});
            }));

becomes

 $(this).load('/mobile/ajax/customers/ .info', function() {        
                $(this).parent().data('loaded', true); 
                $('.loadingscreen').css({'display':'none'});
            });
Ivo Sabev
That's what I thought but it errors :missing ; before statement[Break on this error] }));\n
AnApprentice
This did it: $(this).load('/mobile/ajax/customers/ .info', function() { $(this).parent().data('loaded', true); $('.loadingscreen').css({'display':'none'}); });
AnApprentice
You had one more ending bracket.
Ivo Sabev
FYI, the code worked but ended up breaking JQTOUCH.
AnApprentice
JQTOUCH FAIL :)
Ivo Sabev