Clear questions and runnable code get the best and fastest answer |
|
PerlMonks |
Re: jQuery issue with Dancer2 (return)by tye (Sage) |
on Sep 23, 2016 at 05:39 UTC ( [id://1172408]=note: print w/replies, xml ) | Need Help?? |
Your aux_state() function doesn't return any value. In case you didn't realize, in javascript, 'return' isn't implied like it is in Perl. If that is what you thought, then you also might be assuming that the return value from .get() is the same as the return value from your success function? But I didn't see any mention of a return value from .get() when reading the documentation that I found by searching for jQuery .get. If JavaScript didn't lack co-routines and so didn't force you into the fragmented code of call-back hell, then you could do something like:
And the nature of "call-back hell" infects all of the callers of your function so you probably just can't end up with something that would work for the code you wrote as:
You likely have to have yet another call-back that would get the fetched state passed to it. - tye
In Section
Seekers of Perl Wisdom
|
|