thanks for tips. how about dynamic loading of js code?
my idea is to fetch code via ajax and then eval(), any tips on that?
Aljosa Mohorovic
On 8/13/06, Klaus Hartl <[EMAIL PROTECTED]> wrote:
>
>
> Aljosa Mohorovic schrieb:
> > i'm trying to access "this"/object from ajax callback function, any
> > idea/approach on how to achieve this?
> >
> > replace "this._items" in callback function with working code, any tips
> > appreciated.
> > function test() {
> > this._items = {};
> >
> > this.load_item = function(name, url) {
> > $.get(url, function(o) { this._items[name] = o; } );
> > }
> > }
> >
> > var t = new test();
> > t.load_item('test', 'test.html');
>
>
> I assume this snippet is part of a larger object. Otherwise Mike's
> solution is fine I guess.
>
> Try:
>
> function test() {
> this._items = {};
>
> var self = this;
> this.load_item = function(name, url) {
> $.get(url, function(o) { self._items[name] = o; } );
> }
> }
>
> -- Klaus
>
> _______________________________________________
> jQuery mailing list
> [email protected]
> http://jquery.com/discuss/
>
_______________________________________________
jQuery mailing list
[email protected]
http://jquery.com/discuss/