| Tomas Nielsen | Post date: 2007-01-09 23:57I found this on JavaScriptKit. It shows a nice way of including html on an already loaded page. function HttpRequest(url){ var pageRequest = false //variable to hold ajax object /*@cc_on @if (@_jscript_version >= 5) try { pageRequest = new ActiveXObject("Msxml2.XMLHTTP") } catch (e){ try { pageRequest = new ActiveXObject("Microsoft.XMLHTTP") } catch (e2){ pageRequest = false } } @end @*/
if (!pageRequest && typeof XMLHttpRequest != 'undefined') pageRequest = new XMLHttpRequest()
if (pageRequest){ //if pageRequest is not false pageRequest.open('GET', url, false) //get page synchronously pageRequest.send(null) embedpage(pageRequest) } }
function embedpage(request){ //if viewing page offline or the document was successfully retrieved online (status code=2000) if (window.location.href.indexOf("http")==-1 || request.status==200) document.write(request.responseText) }
HttpRequest("external.htm") //include "external.htm" onto current page
|
| Michael Holmström | Post date: 2007-01-16 09:56 Note that Dominos form-tags can mess around with the
Ajax-implementation in IE6. You´ll need to strip the form-tags from
Domino html-output before pushing it into a div.
|
| Fredrik Stöckel | Post date: 2007-01-16 10:26This is true if you decide to return the complete rendered markup, most XHR implementations I have done either return JSON or XML... and sometimes just a js function call, then this isn't a problem. If you want to return the complete rendered page, you have more things to take care of besides the form element... the html/head/body and so on are all elements that should only exist one time for a page to be considered valid (among other things)…
|
| Michael Holmström | Post date: 2007-01-16 11:06 True indeed. However it "works" within IE with head/body tag and such. But it doesnt even work to render it if the div contains a form-tag.
|