Using JQuery:
function runTimer(seconds, yourUrl) {
setTimeout(function() {
$.get(yourUrl);
}, seconds * 1000;
}
run it:
runTimer(5, 'http://example.com/action.php');
But it won't be possible to redirect to other page using ajax request.
For redirecting use:
function runTimerRedirect(seconds, yourUrl) {
setTimeout(function() {
window.location = yourUrl
}, seconds * 1000;
}