echo "function disp_player (playerID) {";
echo "$.post('editor.php', {'idval': playerID});";
echo "alert(playerID);";
echo "alert(" . $playerlist[$_POST['idval']][0] . ");";
I'm writing a PHP script that is supposed to change text based on a selection made from a drop down.
The page can be viewed here - http://superonlinehockey.com/editor.php
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.
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.