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.
For example:
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.