@学神之女

JOJO,我不想再做人了!!

上个话题

<script>
  function adddata(_this,banzu,list) {
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (this.readyState == 4 && this.status == 200) {
        document.getElementById("ndiv").innerHTML = this.responseText;
      }
    };
    xhttp.open("POST", "http://www.blog.com/index/index/adddata?banzu="+banzu+"&list="+list, true);
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhttp.send("fname=Bill&lname=Gates");
  }
</script>

我应该怎么改?

共 1 个回答
举头望涵涵,低头思第一。 https://www.dffzmxj.com
<script>
  function adddata(_this,banzu,list) {
    //此处加入让加载条显示的代码
    var xhttp = new XMLHttpRequest();
    xhttp.onreadystatechange = function() {
      if (this.readyState === 4) {
        //此处加入让加载条隐藏的代码
      }
      if (this.readyState == 4 && this.status == 200) {
        document.getElementById("ndiv").innerHTML = this.responseText;
      }
    };
    xhttp.open("POST", "http://www.blog.com/index/index/adddata?banzu="+banzu+"&list="+list, true);
    xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
    xhttp.send("fname=Bill&lname=Gates");
  }
</script>

另外,可以直接在上一个问题里“回答”来进行追问。