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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T04:05:04+00:00 2026-05-26T04:05:04+00:00

I have rows loaded from the database via ajax using jquery. It grabs a

  • 0

I have rows loaded from the database via ajax using jquery. It grabs a php page via ajax, the php page gets the results from the db then returns it back and in jquery I display the results within a div on the webpage. I then have a function that runs every 60 seconds that updates each row, however because the data is loaded via ajax it doesnt “see” the elements needed to run this code every 60 seconds. Here is the code that is giving me the undefined error:

var waitlist_info = $('.currbar').attr('title');

Could I use live with jquery for this to work? If so how would I make it work in this case? I only used live to bind to an action like click.

EDIT

Here is additional code. I added the check to see if there is at least once instance of currbar, however when the code runs the currbar check always is zero until 60 seconds later then it works.

    jQuery.noConflict();

    jQuery(function($) {

        function displayListTimes() {

            if($(".currbar:first").length > 0)
            {

                var list_info = $('.currbar').attr('title');
                var break_info = list_info.split('<>');

                $.ajax({
                    type:"GET",
                    data:'tzone=' + break_info[1],
                    url:"/ajax/time.php",
                    success: function(data) {

                        $('.progress').each(function() {
    //code runs here
                        });

                    }

                });

            }

        };

    var socket = io.connect('http://localhost:2424');

    socket.on('connect', function () {
$.get('/getlist.php', function() {});
    });

    socket.on('message', function (json) {
        var obj = $.parseJSON(json);
        $('#listqueue').html(obj.queuelist);
    });

    displayListTimes();
    setInterval(displayListTimes,60000);

});
  • 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-26T04:05:05+00:00Added an answer on May 26, 2026 at 4:05 am

    Without seeing the rest of the code, you are probably getting this error because the function runs before the page loads the first set of elements.

    So you can check if the element exists by using

    if($(".currbar:first")[0]){
      var waitlist_info = $('.currbar').attr('title');
    }
    

    This will stop you from getting undefined error.

    If you are adding html to the page via ajax, you can also use:

    jQuery(document).bind("DOMSubtreeModified", function(){
        var waitlist_info = $('.currbar').attr('title');
        //Then do rest of code here
    });
    

    This won’t run every 60 seconds, but it will run everytime something gets added to the page.

    Also, you can do

    jQuery.post("ajax page", {vars:vars}, function(html){
      jQuery("#someelement").append(html);
      var waitlist_info = jQuery(".currbar").attr("title");
      //whatever code you need here
    });
    

    Again, this is not every 60 seconds.

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

Sidebar

Related Questions

I have an adjacency list of objects (rows loaded from SQL database with the
I have loaded an associative array of records from a MySQL database table. The
I have a table which the rows are loaded dynamically from a recordset. I
I have an SQLite Database with 5000 rows that is loaded into a tableview.
I have table rows of data in html being filled from a CGI application.
I have the following query which have 1000 rows select staffdiscountstartdate,datediff(day,groupstartdate,staffdiscountstartdate), EmployeeID from tblEmployees
I am trying to pull the top three rows from a database based off
I have a listview which loads its data from sqlite database. Each row in
<?php // This is a code to check the username from a mysql database
Basically I have a gridview that is loaded when a DataSet is returned from

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.