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 8502437
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:29:07+00:00 2026-06-11T01:29:07+00:00

I am currently designing a PHP script / AJAX that allows me to do

  • 0

I am currently designing a PHP script / AJAX that allows me to do monitoring, in fact on my intranet I want to retrieve a list of actions that have been stored in the database in the day. So I made a request for the moment I try to view the member asynchronously but it does not work.

In fact I wanted to display the members for testing and after adapting to recover agendas for the actions of this day and asynchronously (without reload) because I have to be able to observe the recorded data in real time.

So I did this code:

In script.js is in the header I put this:

function writeInDiv(text){
    var objet = document.getElementById('monitoring');
    objet.innerHTML = text;
}

function ajax()
{
    var xhr=null;

    if (window.XMLHttpRequest) {
        xhr = new XMLHttpRequest();
    }
    else if (window.ActiveXObject)
    {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    }
    xhr.open("GET", "ajax.php", false);
    xhr.send(null);
    writeInDiv(xhr.responseText);
        setInterval("ajax()",5000);
}

Then I have two other pages, namely that displays the code, it contains the following:

<button onclick='javascript:ajax()'>Afficher</button>
                <div id="monitoring"></div>


<?php

$requette = mysql_query("SELECT * FROM gestionnaire ORDER BY ID DESC LIMIT 0,10");
$result=mysql_query($requette) or die;
While($donne = mysql_fetch_array($requette))
{
$message = htmlentities($donne['nom']);
$pseudo = htmlentities($donne['prenom']);
?>
<b><?php var_dump($donnee); echo $pseudo; ?>:</b> <?php echo $message; ?><br />
<?php
}
?>

the trouble is that nothing appears I have not even an error message, though the table is filled with these fields
I tried a var_dump but in case like this, it is nothing.

I do not know, or it may come from.

  • 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-11T01:29:08+00:00Added an answer on June 11, 2026 at 1:29 am

    Ajax calls are asynchronous, maybe the call didn’t finish at the moment you pass the responseText to writeInDiv. Try the following:

    function writeInDiv(text){
        var objet = document.getElementById('monitoring');
        objet.innerHTML = text;
    }
    
    function ajax()
    {
        var xhr=null;
    
        if (window.XMLHttpRequest) {
            xhr = new XMLHttpRequest();
        }
        else if (window.ActiveXObject)
        {
            xhr = new ActiveXObject("Microsoft.XMLHTTP");
        }
        xhr.open("GET", "ajax.php", false);
        xhr.send(null);
        xhr.onreadystatechange=function()
        {
            if (xhr.readyState==4 && xhr.status==200)
            {
                 writeInDiv(xhr.responseText);
            }
        }
        setTimeout("ajax()",5000);
    }
    

    or with jQuery:

    function ajax() {
        $('#monitoring').load('ajax.php');
        setTimeout("ajax()",5000);
    }
    

    Also, I think you misspelled var_dump($donnee); it may be var_dump($donne);

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

Sidebar

Related Questions

I am currently designing an API where I want that the user to be
I'm currently designing a website that would involve storing a long list of names
We are currently designing a REST API that we want to publish in a
I'm currently designing a web application using php, javascript, and MySQL. I'm considering two
I'm currently designing a system that watches the ranks / views of youtube videos.
I'm currently designing an app that calls for dynamically creating objects and then displaying
I'm currently designing this website http://avs.mybigcommerce.com . The problem is that my styles.css isn't
I am currently designing a class library that will provide data to a web
I'm currently designing an application which I will ultimately want to move to Windows
I am working on a PHP framework and am currently designing error handling. Based

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.