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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:59:28+00:00 2026-05-26T01:59:28+00:00

what i mean by this is after an html page is rendered, how can

  • 0

what i mean by this is after an html page is rendered, how can i get the value by using the html tag id??

ex: get the value of date by using td_date in my JS function??
below the code that puts the data on the page: listSuccess.php

foreach ($pager->getResults() as $msg)
{ 
    echo "<tr id='td_id' value='$msgId'</tr>";
    $date = add_date($msg->getCreatedAt(),$hr=2);
echo "<td class='td_show_contact_item' align='left' id='td_date'>".$date."</td>";
    <td align='left' id='td_subject'>
     <a href="<?php echo url_for('messagebox/read?cursor=').$cursor ?>" style='color:#ff0000 !important' class='spn_small_red_rbc'><?php echo $msg->getSubject();?></a>
   </td>
   echo "<td class='td_show_contact_item' align='left' id='td_from'>".$unique_code_from."</td>";
   echo "<td id='block_url'>( ".$block_url." )</td>";
   echo "</tr>";
   ++$cursor; 

}

so in my JS:

function ax_get_new_msg_details()
{
var mTimer; 
$.getJSON('/apps_dev.php/messagebox/newMessageDetails', function(data) 
{
    var messageExists = $('#' + data.td_id).length > 0;
    if (!messageExists)
    {
        mTimer = setTimeout('ax_get_new_msg_details()',30000);
        var str='<tr id="' + data.td_id + '">';
        str += "<td class='td_show_contact_item' align='left' id='td_date'>"+data.td_date+'</td>';
        str += "<td align='left' id='td_subject'><a href='#' style='color:#ff0000 !important' class='spn_small_red_rbc'>"+data.td_subject+"</a></td>";
        str += "<td class='td_show_contact_item' align='left' id='td_from'>"+data.td_from +"</td>";
        //str += "<td id='block_url'>"+data.block_url+"</td>";
        str +='<tr>';
        var tbl = $('#td_date').parents('table');
        $(tbl).append(str);
        }
    });
}

then newMessageDetails.php in my actions.class.php

public function executeNewMessageDetails(sfWebRequest $request)
{  
    $profile_id = $this->getUser()->getAttribute('profile_id','zero');  
    $new_msgs = RcMessageBoxTablePeer::getNewMessages($profile_id);
    if (count($new_msgs) >= 1)
    {
        foreach ($new_msgs as $row)
        {
           $date = $row->getCreatedAt();
           $subject = $row->getSubject();
           $from = $row->getProfileIdFrom();
           $id = $row->getId();
           $uc_record = RcProfileTablePeer::getById($from);
           $uc_from = $uc_record->getUniqueCode();
           //$block_url = 'Block User',"blocklist/block?unqiue_code=$uc_from",'class=link_medium_blue');
        }
        $output = array("td_date" => $date, "td_subject" => $subject, "td_from" => $uc_from, "td_id" => $id);
    }
    else
       $output = "";

    return $this->renderText(json_encode($output));
}

the data that i get from the JS function is correct but i need to somehow know that what is actually already on my page ie what was rendered already differs from what json returns and if data differs…update the page with the new json data

any advice?

  • 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-26T01:59:29+00:00Added an answer on May 26, 2026 at 1:59 am

    Why not include your td_id in your tr tag and just compare the incoming id with the existing id?

    var str='<tr id="' + data.td_id + '">';
    

    Then in your update put this if condition around your code:

    var messageExists = $('#' + data.td_id).length > 0;
    if (!messageExists) {
    // your existing code
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using following code to display HTML Form on my web page. This
how can I start a function after the open* button is pressed? html <form
I'm using the function below to change the some of the CSS/HTML structure of
Strange program hang, what does this mean in debug? After attaching windbg I found
I mean this module : Option I can't find it, open Option gives me
I have to login to a page using three parameters, after that I have
By which I mean this: Given the input set of numbers: 1,2,3,4,5 becomes 1-5.
What does this mean exactly? I'm doing something like this: File.Copy(@\\foo\bar\baz.txt, @c:\test\baz.txt); MSDN doesn't
What does this mean: Next add reference to: MySql.Data actually I have downloaded mysql
What does this mean and why am I getting this error. Any suggestions on

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.