Closed Thread
Results 1 to 2 of 2

Thread: responseXML returns null

  1. #1
    plits is offline Newbie
    Join Date
    Nov 2006
    Posts
    3
    Rep Power
    0

    responseXML returns null

    I created my first AJAX application and everything was going great when I used responseText to retrieve my data.

    I decided to switch to XML output and now I receive "Object Null" error when I alert my output. When I change it back to responseText I can see the XML output.

    Can someone tell me what is wrong?

    [HIGHLIGHT="JavaScript"]
    function stateChanged()
    {
    if ((xmlRT.readyState==4)&&(xmlRT.status == 200))
    {
    var xmlobj=xmlRT.responseXML;
    alert(xmlobj);
    }
    }

    [/HIGHLIGHT]

  2. CODECALL Circuit advertisement
    Join Date
    Always
    Posts
    Many

     
  3. #2
    Jordan Guest
    There can be several reasons for this but one of the most common is that the content you are reading is not set to text/html.

    In PHP you set it:
    [highlight="php"]
    header("Content-type: text/xml");
    [/highlight]

    An easy way to tell is to load your output into your browser. It should appear in XML format (with a tree like structure) and not just plain text.

Closed Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. json_encode() returns unicode
    By __ak in forum PHP Development
    Replies: 12
    Last Post: 03-22-2011, 03:02 AM
  2. StreamTokenizer (st.nextToken() returns -3???)
    By RnAoDm in forum Java Help
    Replies: 2
    Last Post: 11-06-2010, 04:15 PM
  3. fscanf returns incorrect values in C
    By CheapFungus in forum C and C++
    Replies: 5
    Last Post: 03-21-2010, 09:30 PM
  4. rand() always returns 0.000
    By hellochar in forum C and C++
    Replies: 3
    Last Post: 07-13-2008, 08:39 PM
  5. Function returns nothing.
    By shibbythestoner in forum PHP Development
    Replies: 14
    Last Post: 12-21-2007, 01:20 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts