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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T18:16:02+00:00 2026-05-24T18:16:02+00:00

i have this js piece of code: <script language=JavaScript type=text/javascript> var sendReq = getXmlHttpRequestObject();

  • 0

i have this js piece of code:

<script language="JavaScript" type="text/javascript">
    var sendReq = getXmlHttpRequestObject();
    var receiveReq = getXmlHttpRequestObject();
    var lastMessage = 0;
    var mTimer;
    function handleReceiveChat() 
    {
       if (receiveReq.readyState == 4)
       {
          var chat_div = document.getElementById('div_chat');    
          var xmldoc = receiveReq.responseXML;     
          var message_nodes = xmldoc.getElementsByTagName("message");
          //more code
       }
    }


    function getChatText()
    {
        if (receiveReq.readyState == 4 || receiveReq.readyState == 0) 
        {
           receiveReq.open("GET", 'getChat_xml.php?chat=1&last=' + lastMessage, true);
           receiveReq.onreadystatechange = handleReceiveChat; 
           receiveReq.send(null);
        }
    }
</script>

and in getChat_xml i have this:

$xml = '<?xml version="1.0" ?><root>';
if(!isset($_GET['chat'])) 
{
$xml .='Your are not currently in a chat session.  <a href="">Enter a chat session here</a>';
$xml .= '<message id="0">';
$xml .= '<user>Admin</user>';
$xml .= '<text>Your are not currently in a chat session.  &lt;a href=""&gt;Enter a chat session here&lt;/a&gt;</text>';
$xml .= '<time>' . date('h:i') . '</time>';
$xml .= '</message>';
}
else
{
$last = (isset($_GET['last']) && $_GET['last'] != '') ? $_GET['last'] : 0;
$sql = "SELECT message_id, user_name, message, date_format(post_time, '%h:%i') as post_time" . 
    " FROM message WHERE chat_id = " . db_input($_GET['chat']) . " AND message_id > " . $last;
$message_query = db_query($sql);
//Loop through each message and create an XML message node for each.
while($message_array = db_fetch_array($message_query))
    {
    $xml .= '<message id="' . $message_array['message_id'] . '">';
    $xml .= '<user>' . htmlspecialchars($message_array['user_name']) . '</user>';
    $xml .= '<text>' . htmlspecialchars($message_array['message']) . '</text>';
    $xml .= '<time>' . $message_array['post_time'] . '</time>';
    $xml .= '</message>';
}
}
$xml .= '</root>';

can anybody help here please?? dont understand how this works
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-24T18:16:02+00:00Added an answer on May 24, 2026 at 6:16 pm

    After seeing the code you have posted, these problems come to mind…

    1. You have not actually added an echo $xml; to output the generated XML.
    2. Even after adding an ‘echo’ statement, you may get null responseXML (and hence an undefined getElementsByTagName) because of some errors in your PHP code (maybe the SQL query).
    3. Even if your PHP code is right, you will get null responseXML because u have not sent proper content header (header('Content-Type: text/xml');).
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

In javascript suppose you have this piece of code: <div> <script type=text/javascript>var output =
I have this piece of code: <script language=javascript type=text/jscript> document.write(<img src='http://dm.leadgenesys.com/jpgp.lgt?en=P.........TP_Q=&amp;ur=' + escape(document.referrer) +
I have this piece of simple code. <html> <head> <script type=text/javascript> function changeText() {
Hey guys, I have this piece of jquery code: <script type=text/javascript > $(function() {
I have this piece of javascript: <script type=text/javascript> function show_confirm() { var type =
I have this piece of code written in jQuery and PHP: <script type=text/javascript> $(document).ready(function(){
I have this piece of code: <textarea id=test style=width: 400px; height: 100px></textarea> <script> var
I have this piece of code: $(#faq).click(function () { var url = $.get(faq, {
I have this piece of code: var myObj = function () { this.complex =
I have problem with this piece of code: var el = $('div#editor'); el.find('*[contentEditable]').removeAttr('contentEditable'); It

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.