I have this code:
$(function(){
$("#CASA").click(function(){
rsExecute("rs/rs_luci.php","premi",1,function(cc){});
var col=$( this ).css( "background-color" );
setColor(this, 'yellow');
setTimeout(setColor,1000,this,col);
});
});
function setColor(obj,clr){
$(obj).css( "background-color", clr );
}
rsExecute makes a call via ajax. function(cc){} is executed on success.
I've tried to change the code like this:
$(function(){
$("#CASA").click(function(){
rsExecute("rs/rs_luci.php","premi",1,function(cc){
var col=$( this ).css( "background-color" );
setColor(this, 'yellow');
setTimeout(setColor,1000,this,col);
});
});
});
function setColor(obj,clr){
$(obj).css( "background-color", clr );
}
but it doesn't work because this is undefined.
Is there a way to pass this object to the function inside rsExecute?