How to redirect to another webpage?
You can't redirect to a function. What you can do is pass some flag on the URL when redirecting, then check that flag in the server side code and if raised, execute the function.
document.location = "MyPage.php?action=DoThis";
Then in your PHP code check for "action" in the query string and if equal to "DoThis" execute whatever function you need.
How to go to a URL using jQuery?
//As an HTTP redirect (back button will not work ) window.location.replace("http://www.google.com"); //like if you click on a link (it will be saved in the session history, //so the back button will work as expected) window.location.href = "http://www.google.com";
window.location is just what you need. Other thing you can do is to create anchor element and simulate click on it
$("<a href='your url'></a>").click();
To redirect to another page, you can use:
window.location = "http://www.yoururl.com";
window.location.href = 'http://www.google.com';
window.location = 'http://www.google.com';