Re: innerHTML and AJAX Question

  • From: "E.J. Zufelt" <lists@xxxxxxxxx>
  • To: programmingblind@xxxxxxxxxxxxx
  • Date: Wed, 5 Aug 2009 06:25:41 -0400

Good morning,

You might want to take a look at a javascript library like JQuery. Admittedly there s a learning curve, but it can simplify some of wha you are trying to do.

See http://www.ibm.com/developerworks/library/x-ajaxjquery.html

HTH,
Everett

Follow me on Twitter
http://twitter.com/ezufelt

View my LinkedIn Profile
http://www.linkedin.com/in/ezufelt



On 5-Aug-09, at 6:03 AM, D!J!X! wrote:

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: