简体   繁体   English

无法在Jquery函数中传递变量

[英]Having trouble passing a variable in Jquery function

I have this function 我有这个功能

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();
}

In procData(), I'm trying to pass the variable 'a' to finishAjax, but nothing seems to work. 在procData()中,我试图将变量'a'传递给finishAjax,但是似乎没有任何效果。 It works in all the areas where it is called except this one. 它适用于除此以外的所有区域。 Any ideas? 有任何想法吗?

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM