how to pass javascript array to php
<p></p>

<p>I want to pass array myWorkout to 'play_workout.php'.
I want 'play_workout.php' to open and display the contents of myWorkout (for this example).
<em>(Once I see that this is working I will parse the data from myWorkout and write it back to a database).</em>
I'm not getting any errors in firebug, but play_workout is not being opened nor is is capturing the array object myWorkout.</p>

<p>I would appreciate a second glance at this.
Thanks as always!</p>

<p><strong>page workout_now.php</strong></p>

<pre><code>&lt;div id="playworkout"&gt;&lt;button onClick="playWorkout()"&gt;Play Workout&lt;/button&gt;&lt;/div&gt;
</code></pre>

<p><strong>JAVASCRIPT</strong></p>

<pre><code>function playWorkout(){

  var arr = $("#dropTargetframe &gt; li").map(function(){
  return $(this).attr('data-id');}).get();

     var myRoutine = arr;
     var myWorkout = new Array();
        for (var i in myRoutine){
           if (myRoutine[i])
             myWorkout.push(myRoutine[i]);
            }
          //array appears like ["4", "5", "1", "4"]
          JSON.stringify(myWorkout);
          encodeURIComponent(myWorkout);

         var url = "http://localhost/RealCardio/play_workout.php";

         $.get(url, myWorkout); 
</code></pre>

<p><strong>page play_workout.php</strong></p>

<pre><code>&lt;?php
 ...
 $arrayWorkout = json_decode($_REQUEST['myWorkout']); 
 print_r($arrayWorkout);     
...
?&gt;
</code></pre>
