Follow the simple steps to do HTTP redirect to a URL using JavaScript.
<html>
<head>
<script type='text/javascript'>
forwardUrl(); // calling the function to redirect
function forwardUrl() {
window.location.href = 'http://www.phpboyz.com/page1.php';
}
</script>
</head>
<body></body>
</html>
And we can send the parameters along with the url using this script also.
<script type='text/javascript'>
var value1 = 10;
var value2 = 'testing';
window.location.href = 'http://www.phpboyz.com/page1.php?param1='+value1+'¶m2='+value2;
</script>
Use $param1 = $_GET['param1'] and $param2 = $_GET['param2'] to get the values in the page1.php.
Thank you...
No comments:
Post a Comment