疑問:為何不是執行 location.href = "../exit.html";, 而是執行了 window.location.href = 'http://www.baidu.com'; ?有什么辦法執行完 getData(), 如果獲取數據失敗,則跳轉到 ../exit.html, 不再執行 gourl(); 方法呢?補充:ajax里面的 async: false 是同步請求?。?!,這個只是一個簡單的demo,實際上getData()方法后面可能有很多邏輯,但是如果getData()獲取數據失敗,就不讓程序再執行其他的方法,而且其他的方法不一定在同一個文件里面。
在方法里 window.location.href 不會立即跳轉,有什么方法解決
當年話下
2018-11-19 21:13:13