Getting information from PHP into HTML5 JavaScript Game -
i've been mucking around js/node/socket.io , made little multiplayer game dots , can move around. want take level further , add simple login system can display information user's login above head identify different players.
now know php server-side language , javascript client-side need come way this. i'm asking is, know how information straight php javascript?
later on might want add levelling , store player's levels in database , retrieve them when connect (as opposed using local storage).
thanks much!
joel
you can use php write javascript.
e.g.
$jsvars = array( "one" => "hello" , "two" => "yo" ); echo '<script type="text/javascript">'; echo "var phpvars = ".json_encode($jsvars); echo "</script>";
or can utilise ajax make requests php , pass data via json.
Comments
Post a Comment