You have 2 options:
- In
/member.php?action=login&do=switch
, return a redirect response (http 301) toprivate.php
, the browser will automatically redirect after receiving the response. - Use ajax to call the link
/member.php?action=login&do=switch
, and in the callback of the ajax, redirect toprivate.php
usingwindow.location.href = private.php
.
An example code using jquery:
$("a").click(function(){
var href = $(this).attr("href"); //href here is "/member.php?action=login&do=switch"
$.ajax(
{
url:href,
...
}).done(function(){
window.location.href = "private.php"
});
return false; //prevent default action of links.
});