首页 > 解决方案 > 我的代码在某些更改后停止工作

问题描述

我试图在 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); 
      }
   }

标签: javascriptcodeigniter

解决方案



推荐阅读