无法重新加载页面

时间:2015-01-21 06:39:37

标签: javascript php jquery

function setAction(){ 
  var value; 
  var id = document.getElementById('id').value;
  if(document.getElementById('action1').checked==true){ 
    value = "Active" 
  }
  else if(document.getElementById('action2').checked==true){ 
    value = "Inactive"; 
  }
  else{ 
    value = "other"; 
  } 
  jConfirm('Are you continue?', 'Confirmation Dialog', function(r) {
  if(r==true){ 
    var strURL="process.php?task=setActionProposal&id="+id+"&status="+value+"&value="+document.getElementById('other').value; 
    var req = getXMLHTTP(); 
    if (req) { 
      document.getElementById('loader').style.display='block'
      req.onreadystatechange = function() { 
        if (req.readyState == 4) { 
          // only if "OK" 
          if (req.status == 200) { 
            //alert(req.responseText); 
            obj = JSON.parse(req.responseText); 
            if(obj.valid==true){ 
              document.getElementById('loader').style.display='none';
              window.location.href='user.php'; 
            } 
          } 
          else { 
            // alert("There was a problem while using XMLHTTP:\n" + req.statusText); 
          } 
        } 
      } 
      req.open("GET", strURL, true); 
      req.send(null); 
    } 
  }
  else{ } 
  //jAlert('Confirmed: ' + r, 'Confirmation Results'); }); 
}

我的页面没有重定向错误,任何人都解决了我需要重定向window.location.href='user.php';

2 个答案:

答案 0 :(得分:0)

尝试完整的项目路径 即,

window.location ='您的项目路径/ user.php';

答案 1 :(得分:0)

起初,
你检查一下,

 window.location.href = 'http://www.google.com';

这将正常工作。 然后问题是你的项目路径。