innerHTML and AJAX Question

  • From: "D!J!X!" <megamansuperior@xxxxxxxxxxx>
  • To: "Blind" <programmingblind@xxxxxxxxxxxxx>
  • Date: Wed, 5 Aug 2009 06:03:20 -0400

Hello guys. While reading a document on the w3c site, I came across a set of
xhtml items which described some things to do and others to avoid. Amongst
the things to avoid was the use for the innerHTML. Now when using AJAX this
is what I use to import html from another file into my current page, like
so:
var x=document.getElementById("div_name");
x.innerHTML=xhr.responseText;
 
Now 2 questions:
1. Why stop using innerHTML, I believe I read somewhere that it's
proprietary and that it's not recommended by w3c, not sure. Is this so? Will
it also be depricated?
2. If we can't use innerHTML, is there another way of importing preformatted
html text into an element such as a div using AJAX??? I know the dom methods
can be used, but man! That'll be a lot of coding and adding and removing
childNodes! lol.
I was looking online for alternative and read that you can tell the browser
what content/MimeType the server will be sending back to it in the xml http
request, but couldn't find how to do this... Any help appreciated!
 
Thanks, D!J!X!

Other related posts: