PHP/jQuery : jQuery posts variable but PHP not reading it
<pre><code>echo "function disp_player (playerID) {";
    echo "$.post('editor.php', {'idval': playerID});";

    echo "alert(playerID);";
    echo "alert(" . $playerlist[$_POST['idval']][0] . ");";
</code></pre>

<p>I'm writing a PHP script that is supposed to change text based on a selection made from a drop down.</p>

<p>The page can be viewed here - <a href="http://superonlinehockey.com/editor.php" rel="nofollow">http://superonlinehockey.com/editor.php</a></p>

<p>The first alert works and the playerID is output.  Setting $playerlist[$_POST['idval']][0] to a static value like $playerlist[770][0] also works.  Using Firebug, I see that the value is added to post and, also using Firebug, it looks like the code all works.  However, that second alert gives me an 'Undefined' when I would expect it ot be the same as the first alert.</p>

<p>Can anyone help me?  Am I posting wrong?  I'm new to jQuery so I'm not sure how this is supposed to work but, based on what I do know, I don't see anything wrong with my code.</p>
