Javascript 如何在ajax中使用setTimeout在下一页传递参数?

Javascript 如何在ajax中使用setTimeout在下一页传递参数?,javascript,settimeout,Javascript,Settimeout,我想使用setTimeout将值传递到ajax中的下一页 实际代码是 setTimeout(' window.location.href ="signin.php";',4000); 但我想把它写成这样 setTimeout(' window.location.href ="signin.php?success";',4000); 这样做是行不通的 //we store out timerIdhere var timeOutId = 0; //we define our function

我想使用
setTimeout
将值传递到
ajax
中的下一页

实际代码是

setTimeout(' window.location.href ="signin.php";',4000);
但我想把它写成这样

 setTimeout(' window.location.href ="signin.php?success";',4000);
这样做是行不通的

//we store out timerIdhere
var timeOutId = 0;
//we define our function and STORE it in a var
var ajaxFn = function () {
        $.ajax({
            url: '/echo/html/',
            success: function (response) {
                if (response == 'True') {//YAYA
                    clearTimeout(timeOutId);//stop the timeout
                } else {//Fail check?
                    timeOutId = setTimeout(ajaxFn, 10000);//set the timeout again
                    console.log("call");//check if this is running
                    //you should see this on jsfiddle
                    // since the response there is just an empty string
                }
            }
        });
}
ajaxFn();//we CALL the function we stored 
//or you wanna wait 10 secs before your first call? 
//use THIS line instead
timeOutId = setTimeout(ajaxFn, 10000);
或者你可以

setTimeout(function(){ 
       window.location = "somepage.php?success=y";
       //send id with page
    }, 
1000);
收件人::

或者你可以

setTimeout(function(){ 
       window.location = "somepage.php?success=y";
       //send id with page
    }, 
1000);

By::

您可以按如下方式传递参数

setTimeout(function(){ 
    window.location = "signin.php?success=true";
}, 3000);

这会有用的

您可以按如下方式传递参数

setTimeout(function(){ 
    window.location = "signin.php?success=true";
}, 3000);

这会有用的

将此代码用于功能

setTimeout(function(){ 
       window.location = "signin.php?success=y";
    }, 
4000);

将此代码用于功能

setTimeout(function(){ 
       window.location = "signin.php?success=y";
    }, 
4000);

url
中,必须传递参数,因此需要
?参数=值

因此,在链接之后添加
?参数输入
,并在参数之后设置其值
=值


setTimeout('window.location.href=“signin.php?val=success””,4000)

url
中,您必须传递参数,因此需要
?参数=值

因此,在链接之后添加
?参数输入
,并在参数之后设置其值
=值


setTimeout('window.location.href=“signin.php?val=success””,4000)

检查您的浏览器控制台是否有错误在我的终端工作正常共享您的完整代码。。?在您的代码中,否
ajax
使用?检查您的浏览器控制台是否有错误请在我的结尾处查看您的完整代码。。?在您的代码中,是否不使用ajax?