Ive seen this question asked tons of times, but for something different.
This cant be done through an event.
i want to execute a java script function when server sends certain info.
But i cant just do the
echo <script>;
echo TheFunction();
echo </script>;
because it keeps adding to their html uhh is it called cache? lol
view source and it shows up, i need a way to just call it through php.
ex of what i mean:
function msgbox(msg)
{
alert (msg);
}
server sends "message: blah"
case = "message":
(this is where i need to call function without using echo/print)
any hints??
thanks
[SOLVED] Calling a Javascript function
Moderator: General Moderators
-
RayonMazter
- Forum Newbie
- Posts: 6
- Joined: Wed Feb 02, 2005 6:12 pm
[SOLVED] Calling a Javascript function
Last edited by RayonMazter on Wed Feb 02, 2005 9:34 pm, edited 1 time in total.
-
RayonMazter
- Forum Newbie
- Posts: 6
- Joined: Wed Feb 02, 2005 6:12 pm
making a webversion of a game i made,
purpose is that server sends player list,
then sends a certain string whenever a new player logs in, or someone logs out (which requires the function).
but u just gave me the best idea, thanks.
i'll have php do this
data comes, then it does
echo 'var NewPlayer=' . $data . ";";
then i can just have the function (like u said ) call every few seconds to update the new info,
never would have thought. Thanks again
Rayon
purpose is that server sends player list,
then sends a certain string whenever a new player logs in, or someone logs out (which requires the function).
but u just gave me the best idea, thanks.
i'll have php do this
data comes, then it does
echo 'var NewPlayer=' . $data . ";";
then i can just have the function (like u said ) call every few seconds to update the new info,
never would have thought. Thanks again
Rayon