AJAX returns multiple results how to direct user to another page when a specific result is returned?

I have multiple results being returned when a php function makes a call to a database. The ajax displays the results of those calls in a div element. How do I direct the user to the next page once I get a specific result from the php function? Right now when I try to redirect the page it loads it into the div where I get the returned messages from. html
ajax function loadXMLDoc(){ var xmlhttp; xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange = function() { if (xmlhttp.readyState == 4 && xmlhttp.status == 200) { document.getElementById("ajax").innerHTML = xmlhttp.responseText; } } var a = document.getElementById('email').value; var email ="email="+a; xmlhttp.open("POST","reg.php",true); xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded"); xmlhttp.send(email); } php $email = $_POST['email']; function emailCheck($email) { if($email != null) { return true; } else { echo ' Please add your email. '; } } emailCheck($email);
If you provide your code, it will be much easier for us to try and help your specific case.

以上就是AJAX returns multiple results how to direct user to another page when a specific result is returned?的详细内容,更多请关注web前端其它相关文章!

赞(0) 打赏
未经允许不得转载:web前端首页 » JavaScript 答疑

评论 抢沙发

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址

前端开发相关广告投放 更专业 更精准

联系我们

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

微信扫一扫打赏