简体   繁体   中英

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. It works in all the areas where it is called except this one. Any ideas?

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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