jQuery Ajax PHP redirecting to another page
jquery, php
Solution
$.ajax({
type: "POST",
url: "ajax.php",
data: dataString,
success: function(r)
{
window.location = 'new.php';//window.location.href = 'new.php';
//$("#div").html(r);
},
});
Problem
JavaScript file: ``` $.ajax({ type: "POST", url: "ajax.php", data: dataString, success: function(r) { $("#div").html(r); } }); ``` I want to redirect the page to `new.php` on success condition so in the `ajax.php` file I used `header('Location:new.php');` but instead of redirecting to page `new.php` it is loading the content of `new.php` in the `div`. What changes do I need to make in order to redirect the existing page to a whole new page?