在Jquery函数中传递变量时遇到问题

时间:2010-08-03 04:06:00

标签: jquery

我有这个功能

function procData(a) {
    $('#loading' + a).show();
    $.post("ajax.php?talk=" + a, {
        slot: $('#slot' + a).val()
    }, function (response) {
        $('#talkdesc' + a).fadeOut();
        setTimeout("finishAjax('talkdesc', a, '" + escape(response) + "')", 400);
    });
}

function finishAjax(id, a, response) {
    $('#' + id + a).html(unescape(response));
    $('#' + id + a).fadeIn();
}

在procData()中,我试图将变量'a'传递给finishAjax,但似乎没有任何效果。除了这个之外,它适用于所有被调用的区域。有什么想法吗?

1 个答案:

答案 0 :(得分:1)

setTimeout(function () {
    finishAjax('talkdesc', a, escape(response));
}, 400);