gpt4 book ai didi

javascript - 从其他函数恢复变量

转载 作者:行者123 更新时间:2023-12-01 05:31:10 24 4
gpt4 key购买 nike

我想在我使用 window.var 的远程函数中恢复变量“idl”,但这不起作用。这是我的代码。

function stbStatus(stbInfo){
$.post(
'indexFunctions.php',
{
stbInfo : stbInfo
},
function(data){
$('#screenshot').html(data);
$('#refresh').click({param:status},screenshotRefresh);
$('form').click(function() {
window.idl = this.id;
({param:status},remote);
});

}

);
}
);
},
'json'
);}

远程功能:

function remote(event){
event.preventDefault();
$('html').css('cursor','wait');
var key = $("#"+window.idl).attr('class');
$.get(
'indexFunctions.php',
{
keyName: key
},
function(){
if (key!="KEY_POWER" && key!="RESET")
screenshotRefresh(event);}

请帮助我提前谢谢。

最佳答案

由于 ajax 的异步性质,您需要在 ajax 调用的成功函数内调用远程函数

关于javascript - 从其他函数恢复变量,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37205571/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com