aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes Why isn't _this available in my callback. I see it in Closure. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Why isn Watch "Why isn New topic
Author

Why isn't _this available in my callback. I see it in Closure.

Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6



Especially since friendId is available and working, but in the callback _this is showing as undefined.

Thanks

Mark


Perfect World Programming, LLC - Two Laptop Bag - Tube Organizer
How to Ask Questions the Smart Way FAQ
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

I changed the code to work, kind of a hack, but it works



So I added an ID to the <a link and grab it via that ID, instead of it being the this to the inviteToEvent function. <br /> <br /> Mark rel="nofollow">
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

What if you do



GenRocket - Experts at Building Test Data
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61043
    
  66

_this.toggle() won't work because _this is not a jQuery wrapped set.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Bear Bibeault wrote:_this.toggle() won't work because _this is not a jQuery wrapped set.


So toggle is a JQuery method and that is why I can't call that method.

But still, I found it very odd that _this was undefined in my callback, when it was obviously declared in the outer enclosing function.

So while I wouldn't be able to call toggle(), I should still see it defined and usable with POJS, Plain Ol JavaScript.

Thanks.

I will try Eric's suggestion and see what happens.

Mark
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
My solution? You on drugs. I look nothing like Gregg
Gregg Bolinger
GenRocket Founder
Ranch Hand

Joined: Jul 11, 2001
Posts: 15299
    
    6

Eric Pascarello wrote:My solution? You on drugs. I look nothing like Gregg


Which is unfortunate for you.
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17250
    
    6

Eric Pascarello wrote:My solution? You on drugs. I look nothing like Gregg


Well, I thought it was a great suggestion, and besides Bear, Eric is the one with the always awesome great suggestions, so I just assumed it was Eric's.

Gregg does have some good suggestions, as long as he has had his meds that day. ;)

Mark
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Why isn't _this available in my callback. I see it in Closure.