i have a javascript function which works fine. it returns all the errors messages from the php file to a span of ID resto very fine. i need if php file returns a specific massege (you have sucessfuly regestered!check your email to activated your account) the user should be redirected to another page. can any one help please
function divsub(){
var firstname= document.getElementById('first_name').value;
var lastname= document.getElementById('lastname').value;
var username= document.getElementById('username').value;
var email= document.getElementById('email').value;
var emailconfirm= document.getElementById('confirmemail').value;
var pass= document.getElementById('pass_id').value;
var passconfrim= document.getElementById('confirmpassword').value;
var phone= document.getElementById('phone').value;
var datastring = 'first_name='+firstname+'&lastname='+lastname+'&username='+username+'&email='+email+'&confirmemail='+emailconfirm+'&pass_id='+pass+'&confirmpassword='+passconfrim+'&phone='+phone;
$.ajax({
type:"POST",
url:"regestration.php",
data:datastring,
cache:false,
success:function(html){
if(html === "you have sucessfuly regestered!check your email to activated your account.") {
var ffirstname= document.getElementById('first_name').value;
var eemail= document.getElementById('email').value;
location.href = "rregsuccess.php?first_name="+ffirstname+"&email"+eemail;
}
else{
$('#resto').html(html);
// window.location.href = "regsuccess.php";
}
}
});
return false;
}
// after ajax success
// Redirect user to url
window.open("https://google.com","_self");