Javascript 警告函数中的变量
我创建了一个包含参数的函数,并在另一个函数中警告响应,这就是为什么我创建了一个全局变量imageServer,并希望在AlertFunction函数中警告imageServerJavascript 警告函数中的变量,javascript,Javascript,我创建了一个包含参数的函数,并在另一个函数中警告响应,这就是为什么我创建了一个全局变量imageServer,并希望在AlertFunction函数中警告imageServer var imageServer ; function win(r) { console.log("Response = " + r.response); imageServer = r.response; } function AlertFunction() { al
var imageServer ;
function win(r)
{
console.log("Response = " + r.response);
imageServer = r.response;
}
function AlertFunction()
{
alert(imageServer);
}
function win(r)
{
console.log("Response = " + r.response);
imageServer = r.response;
AlertFunction()
}
我想在AlertFunction函数中提醒r.response,但没有显示任何内容您必须从win函数调用alert函数
var imageServer ;
function win(r)
{
console.log("Response = " + r.response);
imageServer = r.response;
}
function AlertFunction()
{
alert(imageServer);
}
function win(r)
{
console.log("Response = " + r.response);
imageServer = r.response;
AlertFunction()
}
什么时候启动winr和AlertFunction?r是一个XHR对象吗?那么,console.log语句为您提供了预期的输出?你什么意思?什么都没有?这是否意味着警报为空或甚至没有弹出?警报不会弹出up@Katsudoka在这种情况下,您应该向我们展示调用函数AlertFunction的代码。到目前为止,你给了我们什么,我们只能猜测。