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

  • Home
  • SEARCH
  • 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 6354317
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T22:33:25+00:00 2026-05-24T22:33:25+00:00

i added this JS code: <script language=JavaScript type=text/JavaScript> var receiveReq = getXmlHttpRequestObject(); var mTimer;

  • 0

i added this JS code:

<script language="JavaScript" type="text/JavaScript">
    var receiveReq = getXmlHttpRequestObject();
    var mTimer;
    var url = "www-rainbowcode-net/apps_dev.php/messagebox/list";

    function getXmlHttpRequestObject()
    {
        alert("in gethttprequest");
        if (window.XMLHttpRequest)
        {
            return new XMLHttpRequest();
        } 
        else if(window.ActiveXObject)
        {
            return new ActiveXObject("Microsoft.XMLHTTP");
        } 
        else 
        {
            //document.getElementById('p_status').innerHTML = 'Status: Cound not create XmlHttpRequest Object.';
        }
    } 

    function getNewMessage()
    {
        if (receiveReq.readyState == 4 || receiveReq.readyState == 0) 
        {        
            alert("state is" + receiveReq.readyState);
            //var params = "name" + name + "&" + "comment=" + comment;
            receiveReq.open("POST", url, true);
            receiveReq.onreadystatechange = processReqChange;
            receiveReq.send(null);
        }
    }

    function processReqChange()
    {
        // only if req shows "loaded"
        if (receiveReq.status == 200) 
        {
            alert("processed" + receiveReq.responseText);
           document.getElementById("message_area").innerHTML = receiveReq.responseText;
        } 
        else 
        {
            alert("There was a problem retrieving the XML data:\n" +
            receiveReq.statusText);
        }
        mTimer = setTimeout('getNewMessage();',2000);
    }        
</script>

then i have my html mixed with php:

<body onload = "return getNewMessage();">
   <table width='96%' border='0'>
       <?php 
        $cursor = $pager->getFirstIndice(); 
        foreach ($pager->getResults() as $msg)
        { 
            $has_freechat = false;  
            //changed id to withid here
        $freechat_req_link="profiles/confirmfreechat?withid=".$msg->getRcProfileTableRelatedByProfileIdFrom()->getId();                                               
$freechat_req_link=link_to('Freechat',$freechat_req_link,'class=link_small_dark');

        $cc = sizeof ($fc_records);
        for($i = 0; $i < $cc; $i++) 
        {
    if($fc_records[$i]->getProfileIdWith() == $msg->getProfileIdFrom())
    {       
        $has_freechat = true;       
        break;
    }
      } 
      $unique_code_from = $msg->getRcProfileTableRelatedByProfileIdFrom()->getUniqueCode();
      $block_url = link_to('Block User',"blocklist/block?unqiue_code=$unique_code_from",'class=link_medium_blue');
          echo "<div id = 'message_area'>";
      echo "<tr>";
          $date = add_date($msg->getCreatedAt(),$hr=2);
      echo "<td class='td_show_contact_item' align='left'>".$date."</td>";
          $opened_once = $msg->getOpenedOnce();
          if($opened_once >= 1)
          {
              echo "<td class='td_show_contact_item' align='left'>".link_to($msg->getSubject(),   'messagebox/read?cursor='.$cursor,'class=link_medium_blue')."</td>";
          }    
          else
          { ?>
          <td align='left'>
             <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>      
          <?php 
       } 
 echo "<td class='td_show_contact_item' align='left'>".$unique_code_from." ( $block_url )</td>";
   echo "</tr>";
   echo "</div>";
   ++$cursor; 
 }
 </table>

can anybody tell me why my alerts in the 2nd and 3rd function dont execute? the one in the 1st executes

thanks

  • 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-24T22:33:26+00:00Added an answer on May 24, 2026 at 10:33 pm

    in getNewMessage you miss () for processReqChange

    update:

      function getNewMessage()
    {
        if (receiveReq.readyState == 4 || receiveReq.readyState == 0) 
        {        
            alert("state is" + receiveReq.readyState);
            //var params = "name" + name + "&" + "comment=" + comment;
            receiveReq.open("POST", url, true);
            receiveReq.onreadystatechange = processReqChange;
            receiveReq.send(null);
        }
         mTimer = setTimeout("getNewMessage()", 5000);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I Using this code <script type=text/javascript> $(function() { $('#DoTask').click(function(event) { event.preventDefault(); // added this
In my CMS I've added this code <div><?php include(my_contact_form.php) ?></div> which updates to a
I have this code $(.delete2).click(function() { $('#load2').fadeIn(); } I have dynamically added item via
I have added some code which compiles cleanly and have just received this Windows
I created a new content type for a wiki page library. I added this
This client side script is being added to buttons in our existing codebase. It
I'm dynamically adding rows/fields in this code. I have a text field for the
i have a javascript function like this: function addfamily(divName){ var newdiv = document.createElement('div'); newdiv.innerHTML
<SCRIPT Language = JavaScript> function calculate() { a = 12 b = eval(document.form.number.value) c
ADDED: This question is now, I believe, subsumed by this one: Using GNU Screen

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.