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

The Archive Base Latest Questions

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

I am doing a live time stamp update the following way: var refreshtimest; function

  • 0

I am doing a live time stamp update the following way:

 var refreshtimest;

function refreshtimes() {

    var allt = '';

    $("abbr[class=livetimestamp]").each(function () {
        var did = $(this).attr("id");
        did = did.replace("dtime", "");
        var tit = $(this).data("utime");

        allt += ':{}' + did + ',/:{}' + tit;
    });

    $.ajax({
        async: "false",
        type: "POST",
        url: "refreshtimes.php",
        data: {
            alltimes: allt
        },
        success: function (response) {
            if (response.length > 0) {

                var res = response.split("<>");
                var rres = res.length - 1;
                var x = 0;
                var id;

                while (x <= rres) {
                    if (strpos(res[x], ',/') !== false) {
                        id = parseInt(res[x]);
                    } else if (id != "undefined") {

                        document.getElementById("dtime" + id).innerHTML = res[x];
                    }
                    x++;
                }

            }
        }
    });

    refreshtimest = setTimeout("refreshtimes()", 60000);
}

refreshtimest = setTimeout("refreshtimes()", 2000);

OK, that is the javascript, now the parse of the retrieved string sends:

5,/<>36 minutes ago<>2,/<>September 5 at 11:52am<>3,/<>September 5 at   11:48am<>72,/<>September 4 at 4:43pm<>73,/<>September 4 at 3:29pm<>33,/<>September 4 at 3:08pm<>16,/<>September 4 at 2:19pm<>70,/<>September 4 at 2:46pm<>0,/<>September 4 at 3:20pm<>4,/<>September 4 at 3:22pm<>71,/<>September 3 at 1:04pm<>6,/<>September 3 at 3:20pm<>7,/<>September 3 at 3:18pm<>8,/<>September 3 at 3:17pm<>9,/<>September 3 at 3:14pm

My problem is I need to set ids, the response gives 5,/<>readable format of time

whereas 5 is the id to update the html

I would like to update the html without knowing the id but keeping one post only to the server,

example

selecting all abbr with class livetimestamp and sending an ajax call for each is unproductive, making a single string sounds better, in this string as you see from the above js code it sends the id as var did, along with the data, data(“utime”).

I would like to start sending just data from each abbr with a class livetimestamp but be able somehow to have these identified with no id.

something like another loop for each class=livetimestamp but perform the update from the retrieved response – or apply to each selected from the first each assuming these had no id set.

Reason is I want to have

<abbr class="livetimestamp" data-utime"xxxx">html</abbr>

And no

<abbr class="livetimestamp" data-utime"xxxx" id="words_numbers">html</abbr>

it’s just unproductive on the server to keep setting ids be it whether they must be unique or because a counter has to be set up and these counter shouldn’t get mixed with different sections that need a livetimestamp class as well. so to have it working with the class only would be great.

  • 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-11T21:13:09+00:00Added an answer on June 11, 2026 at 9:13 pm

    Basically I don’t think you need to use the id’s in the first place..

    When You use this selector $("abbr[class=livetimestamp]") it parses the DOM in top-down order and all the elements are selected in a sequential manner..

    So instead of sending the ID of the elements you can send the Times itself as a comma separated sting , which are in sequential order.. Then refresh the times on the server and get back in the same format..

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

Sidebar

Related Questions

Not sure what I'm doing wrong with .live() $(function(){ var wrapper = $('#trailer_wrapper'); var
Doing an ajax get request works as expected using the following code: $.ajax({ type:
Doing my first SL4 MVVM RIA based application and i ran into the following
I'm doing some planning for crisis situations (last time we went from 4k visitors
I'm working on a quite big application that is in charge of doing real-time
Is there any way to setup MySQL to every time a row is changed,
should we include event,ui in the resize function every time we use resize so
I don't get what am I doing wrong here Live example at JSBin If
I am looking for a way to implement a live search like the iPhone
I am doing task of loading the live xml file (from live url) 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.