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

The Archive Base Latest Questions

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

I am trying to use jQuery (latest version) & ajax to poll a mysql

  • 0

I am trying to use jQuery (latest version) & ajax to poll a mysql db every x seconds, post.php does a simple search query on the table and limits to 1 row. (eg SELECT id FROM TABLE LIMIT 1)

I’ve got some other jQuery UI (using v1.8) code that displays some modal/dialog boxes on the screen, simply put if post.php returns something from the db I need to initialise the dialog to pop up onto the screen. I’ve done all the popup stuff I am just having issues joining all these bits together – i’ve added some pseudo code of how i expect this to work. Thanks in advance

var refreshId = setInterval(function(){
    $.ajax({
       type: "POST",
       url: "post.php",
       data:  "",
       success: function(html){
         $("#responsecontainer").html(html);
       }
   });  
}, 2000 );s

/* proposed pseudocode */
if (ajax is successful & returns a db row to #responsecontainer) {
   show jQueryUI modal (done this bit already fortunately)
}
  • 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-14T20:47:45+00:00Added an answer on May 14, 2026 at 8:47 pm

    Why don’t you just handle everything within the success block? As you seem to poll for some data, I would also suggest to use JSON.

    var refreshId = setInterval(function(){
        $.getJSON('post.php', function(data){
            if (data.message.length > 0) {
                $("#responsecontainer").html(data.message);
                /* your jquery ui stuff here */
            }
        });  
    }, 2000);
    

    See jQuery getJSON documentation for more details.

    Note: POST should be used to send data, GET to receive data. If you would like to know why and some additional details, you might want to have a look at REST.

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

Sidebar

Related Questions

I'm currently trying to use the YouTube API as part of a jQuery plugin
I am trying to use jquery autocomplete plugin in my application. It works well
I'm trying use jquery to remove a class from an element (not knowing ahead
I'm trying to use jQuery .button() on a checkbox, but i can't understand why
I am trying to use Jquery to resolve my below issue. I have got
I'm trying to use jQuery's $(this) inside of Fancybox's onComplete event, but I'm running
I am trying to use jquery to do an animated scroll from one div
I am trying to use the JQGrid plugin and have run into an issue
Note: This question refers to a very old version of jQuery.validate() (version 1.5). This
What am I doing wrong here? I'm trying to get started with jQuery UI

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.