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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T02:08:52+00:00 2026-06-11T02:08:52+00:00

I have a script for chatting that Used Ajax, I would like to do

  • 0

I have a script for chatting that Used Ajax,

I would like to do a monitoring script in order to allow the administrator to see all exchanges between users.

The thing is that I did not find any script that explain how to receive data from databse with no reload of the page.

If anybody could help me to find that script or give me a tutorial to build it I’ll be glad.

Receive All my utmost Respect.

Kind regards.

SP.

  • 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-11T02:08:53+00:00Added an answer on June 11, 2026 at 2:08 am

    You are using ajax.. the whole concept of ajax is not having to reload the page…

    The best tools for the job are:

    • websockets. Less overhead. 2 way communication. downside: harder to implement and not cross browser
    • server-sent events. Less overhead. 1 way communication, no repeated requests. downside: not cross browser
    • just plain ajax polling… less efficient, more overhead, many requests but it will work everywhere.

    Socket.io (written for nodeJS) is a probably the best for the job. It leverages the right transport (websockets, longpolling, server-sent events, flashsockets, ajax polling) for you and will give you the best performance available.

    Here are a couple php js implementation examples:

    using Server-sent DOM events (not cross browser):
    updates +/- every 3s

    //javascript:
    var source = new EventSource('updates.php');
    source.onmessage = function (event) {
      console.log(event.data);
    };
    
    //php server side:
    <?php
    header("Content-Type: text/event-stream\n\n");
    //..perform queries and put it in $data..
    echo "data: " . json_encode($data) . "\n";
    ?>
    

    using jQuery ajax request: will send a request every 1000ms

    //javascript: 
    var interval_id = setInterval(function(){
        $.ajax({
          type: "POST",
          url: "updates.php",
          success: function(data){
            console.log("Data: ", data);
          }
        });
    }, 1000); //last param is the interval time in ms
    
    //php server side:
    <?php
    //..perform queries and put it in $data..
    echo json_encode($data) . "\n";
    ?>
    

    using phpWebsockets: lib + codesample

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

Sidebar

Related Questions

I have script that handles image rollovers with css. What I would like to
I need to have script.sh , that would create files f1.txt and f2.txt with
I have a script that recursively loops through all the sub directories and compresses
We have script http://site.com/ourscript.php How to add something like enter password block on that
I have script like this : $(#addk).bind(click, function(event){ //alert(here!); $(#loader-overlay).show(); $.ajax({ 'async':False, 'type': POST,
I have script that reads remote file content and writes it to local server.
I have script like this : fullscript.sh if [ ! -f /opt/laks/linux-2.6.33.2.tar.bz2 ] then
I have this script that run to fix my menu bar to the browser
I have an script interpreter that is spawn by a deamon and has to
I have a sh/bash script that needs to call a batch file with parameters

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.