簡體   English   中英

我的代碼在某些更改后停止工作

[英]my code stops working after certain changes

我試圖在 xhr.send(data); 成功后重新加載頁面;

但我認為那失敗了

    var xhr = new XMLHttpRequest();
    xhr.open('POST', "User/adde", true);
    xhr.onload = function(){
        if (xhr.status==403 || xhr.status==404) {

           alert("ERROR LOADING 3-UPLOAD.PHP");
         } else {
           //alert(this.response);
         }
    };

    xhr.send(data); // the data will send from here.

    success: function(data){
      if(data.success == true){ // if true (1)

        setTimeout(function(){// wait for 5 secs(2)

           location.reload(); // then reload the page.(3)

        }, 5000); 
      }
   }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM