use $(this) in ajax callback jquery
Solution 1:
In that case this
is not the same object anymore. Save a reference before and use later:
$(".class").live("focusout", function(){
var $this = $(this);
jQuery.post("phpfile.php",
{
someValue: someValue
},
function(data)
{
// 'this' inside this scope refers to xhr object (wrapped in jQuery object)
var x = $this;
}
)
});
Solution 2:
$(".class").live("focusout", function(){
var this = $(this);
jQuery.post("phpfile.php",{
someValue: someValue
},function(data){
// Now use this instead of $(this), like this.hide() or whatever.
})
});
$(this) in your example was refering to the $.post i think.