Jump to content

Use PHP as Ajax!


shreyaskudav
 Share

Recommended Posts

I want to implement the same concept as it is in ajax! like there would be a server, request and response!

But I want to use only PHP! not Ajax!

 

Battleserver.php will act as a server and battle.php will be at the client side...!

I can send data from battle.php to battleserver.php by using POST method!

But I don't want to make user know that data is send to battleserver.php...!

It should not appear in the URL!

 

How can I do that! ??

Link to comment
Share on other sites

you'll have to use a proxy srcipt then. if you don't want to use Ajax, your form will have to POST to someother-file.php, which can do all the stuff you need under the hood.

Link to comment
Share on other sites

coz I am not use to it.. so I will have to study it deep from the beginning....! And I am quiet good in handling PHP! atleast I know it better the Ajax..

And also its not like that..I never tried it..! last time I tired...but it increased my complication :(

Edited by shreyaskudav
Link to comment
Share on other sites

I suppose you could submit a form to an iframe or something, although the point of ajax is to solve all of those problems. If you're going to use Javascript to populate a form and submit it, might as well just use Javascript to send the actual request. That way you can handle the response.

Link to comment
Share on other sites

PHP doesn't run on the client side. In order to get a PHP script to execute you have to load the page again. Javascript is constantly running on the client side which is what allows AJAX to work. There is no client-side PHP.

Link to comment
Share on other sites

If the reason you don't want to use AJAX is because you're not good at it you're going about the problem the wrong way. An engineer (or developer) has to use the proper tools to get the job done.

You should learn to use AJAX, it's not that difficult.

Link to comment
Share on other sites

shreyaskudav,

 

You have to understand the difference between "client-side" and "server-side".

 

A client is your computer. You see a web page and you click a button. Only your computer knows you clicked the button until you send it to the server (where your PHP lives). The server handles the request and sends a response. When a response is sent the client updates to reflect that response.

 

Shorts of writing a working client side and serve side example there is probably a lot you need to learn if you don't understand this. Keep writing your game (that's how I learned) but you haven't got the knowledge to write it yet (let alone patients).

 

Javascript sends (using ajax) data to your server. PHP handles the ajax request and sends a response back. AJAX updates the browser so players can see what they've done.

 

Keep on keeping on. Good luck.

Edited by MrFish
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...