🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: pl.comp.lang.javascript
Article #51091

Re: object + callback = problem

#51091
From: satellite
Date: Tue, 17 Apr 2012 11:13
21 lines
1384 bytes
On 2012-04-17 11:50, Witold Zywica wrote:

o, w tym wypadku wydaje mi sie ze problem jest tu :

>    this.loadData = function () {
>      $.getJSON('skrypt.php', this.callback);
>    }

this w getJson jest this getJson - a nie Twojej funkcji - ale mozesz 
uniknac 'porywania' this, w taki np. sposob :

function test(){

var that = this;

that.loadData = function () {
$.getJSON('skrypt.php', that.callback);
}


}
Technical Details
Message-ID: <jmjj8p$oun$1@inews.gazeta.pl>
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
References: <fd024171-140c-4cb5-885b-4ca0ceacf3fa@z17g2000yqf.googlegroups.com>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!news-archive.icm.edu.pl!news.gazeta.pl!not-for-mail
From: satellite <piotr-x@gazeta.pl>
Newsgroups: pl.comp.lang.javascript
Subject: Re: object + callback = problem
Date: Tue, 17 Apr 2012 13:13:29 +0200
Organization: "Portal Gazeta.pl -> http://www.gazeta.pl"
Lines: 22
Message-ID: <jmjj8p$oun$1@inews.gazeta.pl>
References: <fd024171-140c-4cb5-885b-4ca0ceacf3fa@z17g2000yqf.googlegroups.com>
NNTP-Posting-Host: hq.gosk.pl
Mime-Version: 1.0
X-Trace: inews.gazeta.pl 1334661209 25559 88.199.14.9 (17 Apr 2012 11:13:29 GMT)
X-Complaints-To: usenet@agora.pl
NNTP-Posting-Date: Tue, 17 Apr 2012 11:13:29 +0000 (UTC)
X-User: piotr-x
In-Reply-To: <fd024171-140c-4cb5-885b-4ca0ceacf3fa@z17g2000yqf.googlegroups.com>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:2.0b2pre) Gecko/20100701 Lightning/1.1a1pre Shredder/3.2a1pre Mnenhy/0.7.6.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 7bit