首頁  >  問答  >  主體

為什麼return false 還是會跳轉

<script>      // Ajax      let btn = document.getElementById("submit");      btn.onclick = function () {          btn.onclick = function () {         // 監控        xhr.onreadystatechange = function () {          // 傳送成功且成功收到伺服器          if (xhr.readyState == 4 && xhr.status == 200) {   1   的json字串;            / / let json = JSON.parse(xhr.responseText);            // 寫入html中;            // let tips = document.getElementById("ptips");回來";          }        };        }        };        let name = document.getElementById("username").value;         let url = "check.php?name=" username "&password=" password;        xhr.open("get", url, true);        // 傳回瀏覽器        xhr.send(null));

P粉751989631P粉751989631674 天前580

全部回覆(0)我來回復

無回覆
  • 取消回覆