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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T07:45:41+00:00 2026-05-14T07:45:41+00:00

I want to create some kind of AJAX script or call that continuously will

  • 0

I want to create some kind of AJAX script or call that continuously will check a MySQL database if any new messages has arrived. When there is a new message in the database, the AJAX script should invoke a kind of alert box or message box.

I’m not quite a AJAX expert (yet anyway) and have Googled around to find a solution but I’m having a hard time to figure out where to begin. I imagine that it is kind of the same method that an AJAX chat is using to see if any new chat-message has been send.

I’ve also tried to search for AJAX (httpxmlrequest) call in a continuously and infinity loop but still haven’t got a solution yet.

I hope there is someone, which can help me with such a AJAX script or maybe nudge me in the right direction.

Thanks
Sincerely
Mestika

  • 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-05-14T07:45:42+00:00Added an answer on May 14, 2026 at 7:45 am

    Step 1 – You need a server-side page that you can call that checks to see if something new has arrived.

    Step 2 – You could adapt the sequential AJAX request script from here (it uses jQuery to simplify the AJAX requests):

    http://www.stevefenton.co.uk/Content/Blog/Date/201004/Blog/AJAX-and-Race-Conditions/

    Currently, this script is for queuing a list of sequential AJAX requests, but you could use it to continually check by changing it like this…

    var InfiniteAjaxRequest = function (uri) {
        $.ajax({
            url: uri,
            success: function(data) {
                // do something with "data"
                if (data.length > 0) {
                    alert(data);// Do something sensible with it!
                }
                InfiniteAjaxRequest (uri);
            },
            error: function(xhr, ajaxOptions, thrownError) {
                alert(thrownError);
            }
        });
    };
    
    InfiniteAjaxRequest ("CheckForUpdate.php");
    

    What are the benefits of using this script?

    Well, rather than checking every “x” seconds, it will only check once the previous request has been received, so it chains the requests. You could add in a delay to throttle this constant request, which I would highly recommend you do – otherwise you will be hitting your site with way too much traffic. You would add that delay in AFTER you’ve done something with the response, but BEFORE you call back into “InfiniteAjaxRequest”.

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

Sidebar

Related Questions

I want to create a dialog that contains some kind of text element (JLabel/JTextArea
I want to create some kind of row image that looks like that but
I want to create some kind of simulation. There will be numerous sprites floating
I want to create a some kind of data duplication check before insertion into
I want to create some function for rendering images from within Joomla v1.5.23. That
I want to create some diagrams for some papers. Diagrams will contain some text,
I have a lot of classes and want to create some kind of 'directory'.
I try to create some kind of file browser. I want to know if
I have some kind of test data and want to create a unit test
I want to create some kind of debugging output for python and want to

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.