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';
能不能够重新加载页面
尝试'location.replace(“user.php”);' – 2015-01-21 06:43:14
我做了,但它不工作我只是控制台,发现对象{帖子:数组[0],成功:假,味精:“没有找到记录”}}味精:“没有找到记录”的帖子:数组[0]成功:false__proto__:对象 – user4464505 2015-01-21 06:48:00
您刚刚张贴不包含变量“有效”,因此代码将无法进入if语句的对象:'如果(obj.valid = = true){'可能你需要检查'obj.success'吗? – 2015-01-21 06:51:13