Hi HLS & Glenn, Glenn - I see what you mean by using straight JS, you were correct I was going straight js and should have been using the ajax calls - thanks for the clarification.
HLS - I tried changing my ajax success from: document.getElementById("destDiv1").innerHTML = thehtml; to $("#destDiv1").html(thehtml); as you suggested and while it does run the alert message, it still fails out on the document.getElementByID in the destination page with the same error: TypeError: document.getElementById("blah1") has no properties Would you be able to paste in your sample app that you created? I am probably missing something small. Thanks for the help and suggestion! -Kevin > From: [EMAIL PROTECTED] > To: jquery-en@googlegroups.com > Subject: [jQuery] Re: AJAX GetElementByID problem > Date: Fri, 31 Aug 2007 02:25:39 -0700 > > > Kevin, I am not sure why you get this property error, but I believe > that the blah1 script will not be evaluated when you go native with > getElementById(). > > Atleast not here when I did a quick emulated test of your code. > However, changing it to: > > $("#destDiv1").html(thehtml); > > worked perfectly, with blah1 script doing the alert and the adding > text to the blah1 <div> container. > > -- > HLS > > Kevin wrote: > > Hi All, > > > > I'm trying to use an ajax call to call a 2nd page which uses a > > getElementByID to set a div's content on that page. If I just try to > > call the 2nd page, I get a js error that I can't run the > > getElementByID because it has no properties. If I change the 2nd page > > to be a callback function and call that via the callback function of > > jquery it works fine, so it sounds like an order of operations problem > > here. Is there anyway to allow getElementByIDs without forcing them > > in a callback function? > > > > Here is my ajax call: > > <div id="destDiv1"> > > <script language="JavaScript"> > > document.getElementById("destDiv1").innerHTML = "<div align=\"center > > \"><img src=\"/ajax/ajax-loader.gif\" alt=\"Loading...\" /></div>"; > > $.ajax({ > > url: 'j1.html?a=' + Math.random(), > > type: 'GET', dataType: 'html', timeout: 60000, > > error: function(a,b,c){ > > document.getElementById("destDiv1").innerHTML = 'Error > > loading > > channel' + a + "|" + b + "|" + c; > > }, > > success: function(thehtml){ > > // do something with HTML > > document.getElementById("destDiv1").innerHTML = thehtml; > > } > > }); > > </script> > > </div> > > > > Now the page to be loaded: > > > > <div id="blah1"></div> > > <script language="JavaScript"> > > alert("hi"); > > document.getElementById("blah1").innerHTML = "<strong>hi</strong>"; > > </script> > > > > This throws the error: TypeError: document.getElementById("blah1") has > > no properties > > > > Any ideas? > > > > Thanks! > > > > -Kevin > _________________________________________________________________ News, entertainment and everything you care about at Live.com. Get it now! http://www.live.com/getstarted.aspx