How to open php page when button is clicked in javascript? (newbie question)

PHP page workout_now.php

<div id="playworkout"><button onClick="playWorkout()">Play Workout</button></div>


function playWorkout(){

function playWorkout() will build an array of values that will be passed as a parameter, but for now I simply want to know the best way to
open “play_workout.php” and close “workout_now.php” when function playWorkout() is called?

Thanks so much!

So this seems to do the trick. Not sure which one is better to use:

window.location = ‘http://localhost/RealCardio/play_workout.php’;
document.location = ‘http://localhost/RealCardio/play_workout.php’;

window.location is the more correct usage - [URL=“”]document.location even though it is supported, is not part of any standard.