vForums Support Banner



 

Welcome Guest! Please Login or Register
vForums Support :: Programming & Coding :: Programming Discussion :: Javascript + PHP - View Topic (Page 1 of 2)Page: 1 2
Topic Rating: *****
Printable View
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Javascript + PHP (27th Feb 10 at 5:39am UTC)
How do I get Javascript to communicate with a PHP file?

I think it is Ajax but I'm not sure how to do it

And how do I get PHP to create/modify txt files to use as basic databases

The answers will help me with an idea I have for one of my forums

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Javascript + PHP (27th Feb 10 at 7:55am UTC)
Using AJAX is the best way, although it depends what it is that you're trying to do! {Smile}
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Javascript + PHP (27th Feb 10 at 9:56am UTC)
Basically I want to be able to build a battle system for one of my forums

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Javascript + PHP (27th Feb 10 at 10:19am UTC)
AJAX can't go cross domain, that's the problem. What do you want this battle system to do? O.o
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Javascript + PHP (27th Feb 10 at 10:41am UTC)
Battle between 2 users, I thought Ajax could go cross domain

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Javascript + PHP (27th Feb 10 at 11:11am UTC)
Nope, as far as I know. AJAX can't.
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Javascript + PHP (27th Feb 10 at 1:45pm UTC)
Than what can I do?

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
Ross
Administrator
*****

[Avatar]

Posts: 3,709
Status: Offline
Gender: Male
Age: 9 14
Joined:  

Additional Groups:
Support Team
***


Reputation: 45%  


pmwwwtwittergtalkvForum
Re: Javascript + PHP (27th Feb 10 at 2:17pm UTC)
 
Than what can I do?


You could use something sometimes referred to as "Poor Mans AJAX" - you can use Javascript to load additional Javascript files to the page.

I don't remember exactly how it works (I think you need some funny onload events to get it working in IE) but the idea is that you create and append a script tag which loads a PHP file on your server, you would pass parameters to this file in it's URL so that it can do something on your server. The file can then return javascript to execute on the page. eg.

var s = document.createElement('script');
s.type = "text/javascript";
s.src = "http://yoursite.com/battle.php?user=admin&action=something&bar=foo";
document.getElementsByTagName('head').item(0).appendChild(s);

Image
Aiken
Full Member
***

[Avatar]

Posts: 333
Status: Offline
Gender: Male
Location: In a very lonely place, the domain of despair
Age: 35
Joined:  
Reputation: 12%  


pmtwitterskypemsnyahooxfire
Re: Javascript + PHP (27th Feb 10 at 4:07pm UTC)
Ah, I see

vF forums:
Perfect World RP
BLEACH Universe - Under Construction / Testing Phase
Xen Qarna RP - Stage I
Vyren Entar Battle Network RP - Under Construction / Maintenance Mode Enabled
the Final Anime Hideout
indu
New Member
*

Posts: 4
Status: Offline
Joined:  
Reputation: 0%  


pm
Re: Javascript + PHP (9th Mar 10 at 9:33am UTC)
hai
i dn't know
dog199200
Guest
Re: Javascript + PHP (9th Mar 10 at 10:26pm UTC)
yea aiken, this was the problem I was having with getting the IM system working {Tongue Out} the Ajax didn't like the cross domain. Though as for your flat file question

you can use php function fileopen with the function fileread and filewrite *I think thats what they are called* you'd have to google how the functions work, but you could also look into setting up a flat file database with PHP, but i can tell you know, it depends on how advanced you want to go, it might be better to just use mysql to store the information then storing it as a fiat file system.
Marc
vChat Developer
*****
I <3 Rossy

Posts: 3,388
Status: Offline
Gender: Male
Location: Ontario, Canada
Age: 32
Joined:  

Additional Groups:
Coding Team
***


Reputation: 40%  


pmwww
Re: Javascript + PHP (9th Mar 10 at 10:49pm UTC)
 
hai
i dn't know


Hello there, welcome to vForums! {Smile}

To introduce yourself to fellow members, please visit the Introductions board.

Please take the time to have a read over our Global Forum Rules & Info to get to know our rules and regulations.

We hope you enjoy your time here! {Smile}

rroll.to— Shorten a link, rickroll your friends.
indu
New Member
*

Posts: 4
Status: Offline
Joined:  
Reputation: 0%  


pm
Re: Javascript + PHP (26th Mar 10 at 8:19am UTC)
what is html
indu
New Member
*

Posts: 4
Status: Offline
Joined:  
Reputation: 0%  


pm
Re: Javascript + PHP (26th Mar 10 at 8:19am UTC)
html is
Michael
Moderator
*****

[Avatar]
Recoding the future

Posts: 4,043
Status: Offline
Gender: Male
Location: UK
Joined:  

Additional Groups:
Coding Team
***


Reputation: 58%  


pmtwittervForum
Re: Javascript + PHP (26th Mar 10 at 9:12am UTC)
indu: Please read the PM that I have sent you.
 Printable View
Page: 1 2

All times are GMT+0 :: The current time is 10:46pm
Page generated in 2.1447 seconds
This Forum is Powered By vForums (v2.4)
Create a Forum for Free | Find Forums