Javascript can';无法重新加载页面
我的页面没有重定向这有什么问题吗?我需要用Javascript can';无法重新加载页面,javascript,php,jquery,Javascript,Php,Jquery,我的页面没有重定向这有什么问题吗?我需要用window.location.href='user.php'重定向的任何人都可以解决吗尝试完整的项目路径 即 window.location='your project path/user.php'首先, 你检查一下 function setAction(){ var value; var id = document.getElementById('id').value; if(document.getElementById('acti
window.location.href='user.php'重定向的任何人都可以解决吗代码>尝试完整的项目路径
即
window.location='your project path/user.php'首先,
你检查一下
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'); });
}
这将正常工作。
然后问题是您的项目路径。尝试location.replace(“user.php”)代码>我这样做了,但它不起作用,我只是控制台并找到了对象{posts:Array[0],success:false,msg:“找不到记录”}msg:“找不到记录”posts:Array[0]success:false\uuuu proto\uuo:Object您刚刚发布的对象不包含变量“valid”,因此代码不会进入if语句:if(obj.valid==true){
您可能需要检查obj.success
?obj=JSON.parse(req.responseText);那么JSON.parse是否有任何错误也请允许我调试相同的问题,这很好,但是obj=JSON.parse(req.responseText);成功失败了吗
window.location.href = 'http://www.google.com';