> Erik Beeson wrote:
> The value from $.get CAN NOT be returned from isTracked because isTracked will
> have returned before the $.get callback executes.
Shame :/ But thank you for that answer. I was fighting because I
thought that it is possible. Waste of time :/
So I have no choice and put all
> Michael Geary wrote:
> > You're still expecting things to happen in the wrong order.
> > It's *inside the callback* that the data becomes available,
> > and this is long after isTracked() returns.
> From: [EMAIL PROTECTED]
> Yes, but I want have a function that will return what i get from
> i
As I said to you offlist, it doesn't work that way. The value from $.get CAN
NOT be returned from isTracked because isTracked will have returned before
the $.get callback executes. Instead of:
if(isTracked(code) == 'true') {
// thing A
} else {
//thing B
}
You have to do:
isTracked(code, fun
Michael Geary wrote:
> You're still expecting things to happen in the wrong order. It's *inside the
> callback* that the data becomes available, and this is
> long after isTracked() returns. Try this instead:
Yes, but I want have a function that will return what i get from
istracked.php
to use
> To answer your specific question, setting
> a variable who's scope is outside the callback is as easy as defining the
> variable outside the callback:
>
> var foo;
> $.get(..., function() { foo = ...; });
Ahh, I know know where was my mistake.
I tried something like that:
function a() {
var r
007 7:01 AM
> To: jQuery (English)
> Subject: [jQuery] Re: functions after $.get work strange
>
>
> > function isTracked(personcode, callback) {
> > $.get('trackstudent/istracked.php', {'personcode': personcode},
> > callback);
> >
> > }
First of all - Thank You very much - it is good lesson.
> To answer your specific question, setting
> a variable who's scope is outside the callback is as easy as defining the
> variable outside the callback:
>
> var foo;
> $.get(..., function() { foo = ...; });
I tried that before:
function te
> function isTracked(personcode, callback) {
> $.get('trackstudent/istracked.php', {'personcode': personcode}, callback);
>
> }
>
> isTracked(code, function(tracked) {
> // do something with tracked, exactly as you would have done above.
>
> });
I thought that I understand that but Im doing s
Erik Beeson wrote:
> $.get is asynchronous, meaning the call to $.get returns immediately,
> even before the callback has happened. To answer your specific
> question, setting a variable who's scope is outside the callback is as
> easy as defining the variable outside the callback:
Erik - your
$.get is asynchronous, meaning the call to $.get returns immediately, even
before the callback has happened. To answer your specific question, setting
a variable who's scope is outside the callback is as easy as defining the
variable outside the callback:
var foo;
$.get(..., function() { foo = ...
10 matches
Mail list logo