This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


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

Thanks

Mark
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if you do

 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64700
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
_this.toggle() won't work because _this is not a jQuery wrapped set.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 15385
6
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My solution? You on drugs. I look nothing like Gregg
 
Gregg Bolinger
GenRocket Founder
Ranch Hand
Posts: 15302
6
Chrome IntelliJ IDE Mac OS X
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eric Pascarello wrote:My solution? You on drugs. I look nothing like Gregg


Which is unfortunate for you.
 
Mark Spritzler
ranger
Sheriff
Posts: 17278
6
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic