Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

redirect after alert box

I want to redirect page after clicking an alert box "OK" button

This is my code, but this is not working. The alert box is coming up but when I press OK button it redirects to the same page. I want to redirect http://localhost/project/index.php/Con_Group_View this page.

else
{
    echo '<script type="text/javascript">';
    echo'alert("Your Group Already Created ");';
    echo 'window.Location="http://localhost/project/index.php/Con_Group_View";';
    echo '</script>';
}
like image 523
qwerty Avatar asked Mar 09 '26 06:03

qwerty


1 Answers

You want window.location.href = "http://localhost/project/index.php/Con_Group_View" not window.Location. Remember, names are case-sensitive in javascript.

Also note this is a duplicate of How to redirect to another webpage in JavaScript/jQuery?

like image 86
Sherif Avatar answered Mar 11 '26 21:03

Sherif