Object Expected Error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • renji1981
    New Member
    • Dec 2006
    • 8

    Object Expected Error

    Hi Pals

    Im getting Object Expected Error and Im new to Ajax . I have pasted the Html code here .. please help .

    Code:
    <html>
    <head> 
    <title>My first ajax Application </title>
    <script language="javascript">
    var XMLHttpRequestObject =false;
    if(window.XMLHttpRequest)
    {
    XMLHttpRequestObject = new XMLHttpRequest();
    }
    else if(window.ActiveXObject)
    {
    XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
    }
    funtion getdata(datasource , divid)
    {
    if (XMLHttpRequestObject)
    {
    var obj = document.getElementById(divid);
    XMLHttpRequestObject.open("GET",datasource);
    XMLHttpRequestObject.onreadystatechange = funcion()
    {
    if (XMLHttpRequestObject.readystate ==4 && XMLHttpRequestObject.status ==200)
    {
    obj.innerHTML = XMLHttpRequestObject.responseText;
    }
    } 
    XMLHttpRequestObject.send(null);
    }
    }
    </script>
    </head>
    <body>
    <form>
    <input type ="button" value="Click here " onclick="getdata('data.txt','target')">
    </form>
    <div id = "target">
    Hi this is just a test
    </div>
    </html>
    the data file is in the same folder as the html file is and just contains some basic text
    do reply to[edit]
    Last edited by gits; Jan 18 '09, 10:36 AM. Reason: drop email according to posting guidelines; added code tags
  • Dormilich
    Recognized Expert Expert
    • Aug 2008
    • 8694

    #2
    there are some typos creating havoc:
    line #4 better use the type attribute
    line #14 the keyword is "function"
    line #20 (same as line #14)

    Comment

    • renji1981
      New Member
      • Dec 2006
      • 8

      #3
      Originally posted by Dormilich
      there are some typos creating havoc:
      line #4 better use the type attribute
      line #14 the keyword is "function"
      line #20 (same as line #14)

      thanks for the reply ...there is no error now . but it is not loading the file contents which i have in the Data.txt file .My first ajax Application ... can you please check it

      Comment

      • Dormilich
        Recognized Expert Expert
        • Aug 2008
        • 8694

        #4
        it's a typo again:
        line #22: XMLHttpRequestO bject.readyState

        note: unbeatable for debugging: Firebug plugin for Firefox

        Comment

        • renji1981
          New Member
          • Dec 2006
          • 8

          #5
          Thanks a lot ... Works Perfect Now .... Really appreciate the Quick response from this site .. i waited 2 days in another site and dint get get even 1 replies . Thanks to the Moderators

          Comment

          • Dormilich
            Recognized Expert Expert
            • Aug 2008
            • 8694

            #6
            I'm pleased about such a praise, nevertheless we're here to help (Experts, Members (and Moderators))

            Comment

            Working...