在我的页面中,我需要将当前变量作为参数赋予函数AjaxLoader,然后向其中添加选定的类。 但是,当我将它作为参数传递它不起作用。有没有办法做到这一点? 我的代码如下。在jquery中添加这个参数作为参数
$('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");
}
})
}
您收到了什么错误元素的后裔?在添加课程以查看内容之前,您是否曾尝试将'current'记录到控制台? – slash197 2012-03-22 12:49:39