In my page I need to give my current variable as parameter to the function AjaxLoader and then add class selected to it.
However when I pass it as parameter it doesn’t work. Is there a way to do this?
My code is below.
$('a').click(function() {
var current = $(this).find('td');
current.addClass("selected");
AjaxLoader(current);
}
function AjaxLoader(current){
$.ajax({
type: "POST",
url: "test1.php",
success: function(response) {
//this is what I want to do
current.addClass("selected");
}
})
}
Also you may use context member of ajax argument
See http://api.jquery.com/jQuery.ajax/