0

Javascript 请求卡在...处理中。

这是我的javascript:

function checklink() {
    var hr = new XMLHttpRequest();
    var url = "new_item.php";
    var tratata = document.getElementById("yl1").value;
    var vars = "yl=" + tratata;

    hr.open("POST", url, true);

    hr.setRequestHeader("Content-type", "application/x-www-form-urlencoded");

    hr.onreadystatechange = function () {
        if (hr.readyState == 4 && hr.status == 200) {
            var return_data = hr.responseText;
            document.getElementById("status2").innerHTML = return_data;
        }
    }

    hr.send(vars);
    document.getElementById("status2").innerHTML = "processing...";
}

这是位于同一页面上的php:

<?php
if (isset($_POST["yl"])) {
  $yli = $_POST["yl"];
      /* ... */
}
4

0 回答 0