Incorporating PHP in a javascript pop-up messages

C++, C#, Java, PHP, ect...
Post Reply
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Incorporating PHP in a javascript pop-up messages

Post by ZeroComp »

Well I got all the pop up boxes working and am just wondering, say I have an attack button and a pop up comes up saying how much you hit. How do i make it use the php script without doing WHOLE javascript makeover?
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Incorporating PHP in a javascript pop-up messages

Post by Torniquet »

umm woudnt you do something like

alert(<?php echo $damageDelt; ?>)

or something similar to that.
New Site Coming Soon! Stay tuned :D
ZeroComp
Posts: 648
Joined: Thu Oct 29, 2009 8:48 pm

Re: Incorporating PHP in a javascript pop-up messages

Post by ZeroComp »

oh durrr thanks, im a bit new to js so excuse my poor knowledge of javascript :lol:
Coding-PHP, Javascript, C++, HTML, mySQL
Modeling/Art-Blender, GIMP
Games-Unity, Game Maker 8
User avatar
hallsofvallhalla
Site Admin
Posts: 12026
Joined: Wed Apr 22, 2009 11:29 pm

Re: Incorporating PHP in a javascript pop-up messages

Post by hallsofvallhalla »

yes or you can set it when you define the variable

var damagedealt = <?php echo $damageDelt; ?>;

alert(damagedealt);
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Incorporating PHP in a javascript pop-up messages

Post by Torniquet »

ZeroComp wrote:oh durrr thanks, im a bit new to js so excuse my poor knowledge of javascript :lol:
dnt worry lol. im in the same boat.

look into using jquery. makes life no much easier lol
New Site Coming Soon! Stay tuned :D
User avatar
Chris
Posts: 1581
Joined: Wed Sep 30, 2009 7:22 pm

Re: Incorporating PHP in a javascript pop-up messages

Post by Chris »

Torniquet wrote:
ZeroComp wrote:oh durrr thanks, im a bit new to js so excuse my poor knowledge of javascript :lol:
dnt worry lol. im in the same boat.

look into using jquery. makes life no much easier lol
jQuery is a load of balls. It's an extra 4000 lines of code when you don't even use half of it.
Fighting for peace is declaring war on war. If you want peace be peaceful.
User avatar
Torniquet
Posts: 869
Joined: Sun Aug 02, 2009 6:18 am

Re: Incorporating PHP in a javascript pop-up messages

Post by Torniquet »

Chris wrote:
Torniquet wrote:
ZeroComp wrote:oh durrr thanks, im a bit new to js so excuse my poor knowledge of javascript :lol:
dnt worry lol. im in the same boat.

look into using jquery. makes life no much easier lol
jQuery is a load of balls. It's an extra 4000 lines of code when you don't even use half of it.
for you maybe. but i find it easier, whether i use the entire thing or not.
New Site Coming Soon! Stay tuned :D
Post Reply

Return to “Coding”