Advanced Search

Results 1 to 1 of 1

Thread: IE error parsing xml from Basic Ajax Routine

  1. #1
    Join Date
    Nov 2007
    Posts
    19
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default IE error parsing xml from Basic Ajax Routine

    1) Script Title: Basic Ajax Routine

    2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...jaxroutine.htm

    3) Describe problem:

    I used the Basic Ajax script to fetch some XML data based on the user selecting a value from a drop down list - when the XML returns I can see it looks correct via the Alert function. At the end of the function I push the XML values to the fields in a form on the page.

    This code works properly in Firefox.

    In IE I get an error - Object Required which occurs on the line that begins document.forms..

    I think it is complaining about myvirtdoc.getElementsByTagName part since I can put in a static string on the right side of the '=' sign and IE stops complaining.

    Can anyone help me out by explaining why IE doesn't like this and how to fix it.


    Code:
    <script type="text/javascript" >
    
    // function to make ajax request and then push values to field forms
    
    function processGetPost(){
    var myajax=ajaxpack.ajaxobj
    var myfiletype=ajaxpack.filetype
    if (myajax.readyState == 4){ //if request of file completed
    if (myajax.status==200 || window.location.href.indexOf("http")==-1){ //if request was successful or running script locally
    if (myfiletype=="txt")
    alert(myajax.responseText)
    else
    alert(myajax.responseXML)
    myvirtdoc=(myajax.responseXML)
    
    // push values to form
    document.forms["recSurvTime"].CustRate.value= (dropped down for clarity)
    myvirtdoc.getElementsByTagName("custrate")[0].childNodes[0].nodeValue;
    
    }
    }
    }
    </script>
    thanks,
    Kevin
    Last edited by kevin_dalby; 01-28-2008 at 08:32 PM.

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
  •