You're within the scope of another function.
If you want to keep a reference to the clicked link, you could do
something like this:
$j("a.complete").click(function () {
var $aComplete = $j(this); // <-- hold onto to $j(this)
$j.getJSON("https://foobar?my=" + $j(this).attr("title"),
function(data){
if (data.status == "Completed") {
//Woohoo, it worked!
alert("Woohoo!");
//Now lets change the div style!
$aComplete.parent().removeClass('foobar'); // <-- reference the
clicked link ( $j(this) )
//Hey, that didn't do anything!
//This worked above, lets test and see if it contains a
value.
alert($aComplete.attr("title")); // <--
reference the clicked link ( $j(this) )
//undefined? =(
}
});
Doesn't look like you're doing anything with the data that you're
retrieving, though. Was that left out for example brevity?
--Karl
____________
Karl Swedberg
www.englishrules.com
www.learningjquery.com
On Sep 7, 2008, at 1:00 AM, Skeeter wrote:
Hi. Can anyone tell me while once I get inside the success function
$j(this) is no longer defined?
Thanks! :)
$j("a.complete").click(function () {
$j.getJSON("https://foobar?my=" + $j(this).attr("title"),
function(data){
if (data.status == "Completed") {
//Woohoo, it worked!
alert("Woohoo!");
//Now lets change the div style!
$j(this).parent().removeClass('foobar');
//Hey, that didn't do anything!
//This worked above, lets test and see if it contains a
value.
alert($j(this).attr("title"));
//undefined? =(
}
});