This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
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
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Reply 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: 17233
    
    1



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: 17233
    
    1

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
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

What if you do

Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56199
    
  13

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


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Mark Spritzler
ranger
Sheriff

Joined: Feb 05, 2001
Posts: 17233
    
    1

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: 15357
    
    6
My solution? You on drugs. I look nothing like Gregg
Gregg Bolinger
Ranch Hand

Joined: Jul 11, 2001
Posts: 15230

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: 17233
    
    1

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.
 
Similar Threads
Forms in overlay/FancyBox and updating page. JQuery
Weird issue while populating a table using jquery
Passing arguments to function passed to event click function.
Confirm FancyBox, buttons not calling click functions.
Page section does not update after call of a4j:support in IE 9