Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8165799
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T19:38:52+00:00 2026-06-06T19:38:52+00:00

It may sound odd, but I’ve been programming games in PHP. The main problem

  • 0

It may sound odd, but I’ve been programming games in PHP. The main problem I’ve found was that the only way to update PHP is to load a page. That makes real-time slow. Javascript can interact with a page without reloading it. Is it possible to load PHP pages on a page using Javascript? So that it would allow PHP to be loaded over and over without reloading.

I’ve seen it done with Chat rooms but not sure how it works.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-06T19:38:53+00:00Added an answer on June 6, 2026 at 7:38 pm

    We mostly use Ajax, which consists in a client-side Javascript code that calls a server-side page, with out leaving the page.

    Here’s an example that will get the displayed content of a page, using the GET method (JSFiddle):

    var xhr = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHttp');
    xhr.onreadystatechange = function(){
        if(xhr.readyState==4 && ((xhr.status>=200 && xhr.status<300) || xhr.status==304)){//Checks if the content was loaded
            console.log(this.responseText);
        }
    }
    xhr.open('GET','myPHPPage.php?foo=foo&bar=bar',true);
    xhr.send();
    

    And here using the POST method (JSFiddle):

    var xhr = XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject('Microsoft.XMLHttp');
    var data = 'foo=foo&bar=bar';
    xhr.onreadystatechange = function(){
        if(xhr.readyState==4 && ((xhr.status>=200 && xhr.status<300) || xhr.status==304)){//Checks if the content was loaded
            console.log(this.responseText);
        }
    }
    xhr.open('POST','myPHPPage.php',true);
    xhr.setRequestHeader('Content-type','application/x-www-form-urlencoded');
    xhr.setRequestHeader('Content-length',data.length);
    xhr.send(data);
    

    Note that here we use the setRequestHeader method to change the headers of this HTTP request and, in this case, to change the Content-type and the Content-length (this header has a default value of 4096 bytes). Also, the setRequestHeader method must be called after the open method.

    These links should help you:

    https://developer.mozilla.org/en/Ajax

    http://code.google.com/intl/pt-BR/edu/ajax/tutorials/ajax-tutorial.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a question that may sound odd, but being somewhat of a newbie,
This may sound like a stupid question, perhaps it is. But I'm only trying
It may sound strange, but in my PHP application I need to check if
This question may sound like for beginners, however when I found that out I
The question may sound strange but I've been struggling with it for a few
Hi so this may sound odd but lets say currently I am doing this:
This may sound simple but i am stuck up at a very strange problem.
It may sound a bit stupid, but is there a shorter way of writing
This may sound strange, but I need a better way to build python scripts
The title may sound a bit odd but I wanted to keep the title

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.