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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -