Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. AJAX using DIV throws a runtime error

AJAX using DIV throws a runtime error

Scheduled Pinned Locked Moved Web Development
helphardware
5 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    ajisthekingofpop
    wrote on last edited by
    #1

    I have a div which is embedded inside a table. I can manually find the element using getByElementId("mytag"); I can even statically assign innerHTML, but my problem occurs when i try and assign it the responsetext from a XMLHTTP Object. If the DIV tag exists out the table on its own, then everything workds fine, its just when the div is embedded inside a table or even a form. What am i doing wrong, someone please help. I can document.write the responseText and its correct, I can even statically assign 'hello' to the innerHTML of my tag and all works. Any suggestions would be appreciated.

    B B 2 Replies Last reply
    0
    • A ajisthekingofpop

      I have a div which is embedded inside a table. I can manually find the element using getByElementId("mytag"); I can even statically assign innerHTML, but my problem occurs when i try and assign it the responsetext from a XMLHTTP Object. If the DIV tag exists out the table on its own, then everything workds fine, its just when the div is embedded inside a table or even a form. What am i doing wrong, someone please help. I can document.write the responseText and its correct, I can even statically assign 'hello' to the innerHTML of my tag and all works. Any suggestions would be appreciated.

      B Offline
      B Offline
      badgrs
      wrote on last edited by
      #2

      Without any code I don't think anyone can really help.

      A 1 Reply Last reply
      0
      • B badgrs

        Without any code I don't think anyone can really help.

        A Offline
        A Offline
        ajisthekingofpop
        wrote on last edited by
        #3

        the Jscript code is: function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function stateChanged() { if (xmlHttp.readyState==4) { alert('got data'); //document.writeln(xmlHttp.responseText); var item = document.getElementById("cont"); //alert(item); var res = xmlHttp.responseText; item.innerHTML = res; //.innerHTML=; } } function loadArticle(id){ //alert('id is ' + id); xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="articles.aspx"; url=url+"?id="+id; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } the htnl sits klike this

        o.k assigning just "hello" to the innerHTML of cont works fine, but try and assign responseText and I getthe runtime error.

        A 1 Reply Last reply
        0
        • A ajisthekingofpop

          the Jscript code is: function GetXmlHttpObject() { var xmlHttp=null; try { // Firefox, Opera 8.0+, Safari xmlHttp=new XMLHttpRequest(); } catch (e) { // Internet Explorer try { xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); } catch (e) { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); } } return xmlHttp; } function stateChanged() { if (xmlHttp.readyState==4) { alert('got data'); //document.writeln(xmlHttp.responseText); var item = document.getElementById("cont"); //alert(item); var res = xmlHttp.responseText; item.innerHTML = res; //.innerHTML=; } } function loadArticle(id){ //alert('id is ' + id); xmlHttp=GetXmlHttpObject(); if (xmlHttp==null) { alert ("Your browser does not support AJAX!"); return; } var url="articles.aspx"; url=url+"?id="+id; xmlHttp.onreadystatechange=stateChanged; xmlHttp.open("GET",url,true); xmlHttp.send(null); } the htnl sits klike this

          o.k assigning just "hello" to the innerHTML of cont works fine, but try and assign responseText and I getthe runtime error.

          A Offline
          A Offline
          ajisthekingofpop
          wrote on last edited by
          #4

          there is a < div > tag but it disappeared on posting. Its in the table cell.

          1 Reply Last reply
          0
          • A ajisthekingofpop

            I have a div which is embedded inside a table. I can manually find the element using getByElementId("mytag"); I can even statically assign innerHTML, but my problem occurs when i try and assign it the responsetext from a XMLHTTP Object. If the DIV tag exists out the table on its own, then everything workds fine, its just when the div is embedded inside a table or even a form. What am i doing wrong, someone please help. I can document.write the responseText and its correct, I can even statically assign 'hello' to the innerHTML of my tag and all works. Any suggestions would be appreciated.

            B Offline
            B Offline
            bartedgerton
            wrote on last edited by
            #5

            Have you tried it in different browsers? I wonder if its a client-side error or a server-side error. You might also check to make sure you don't have a reserved name issue. Bart Edgerton http://www.ewebdev.net

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups