OK, try this. It's the same idea as the code I posted before:

    var blah = {
        dynaLoad : function( variable ) {
            $.get( 'alert.js', function( code ) {
                var fn = new Function( 'variable', code );
                fn( variable );
            });
        },
        somethingElse : ''
    };
    
    blah.dynaLoad('cool beans'); 

-Mike

> -----Original Message-----
> From: jquery-en@googlegroups.com 
> [mailto:[EMAIL PROTECTED] On Behalf Of jquertil
> Sent: Tuesday, July 08, 2008 1:37 AM
> To: jQuery (English)
> Subject: [jQuery] Re: $.getScript() - how to load into JSON 
> formatted object?
> 
> 
> thanks for the answer Mike. I probably wasn't very clear.
> 
> I'm trying to make the loading happen as part of 
> blah.something(variable).
> 
> something kinda like this:
> 
> var blah ={
>    dynaLoad : function(variable){
>       $.getScript('alert.js',variable) // the script would 
> simply contain the line "alert(variable);"
>    },
>    somethingElse : ''
> }
> 
> blah.dynaLoad('cool beans'); // this would now produce a "cool beans"
> alertbox.
> 

Reply via email to