How to use document.write() in HTML loaded via Ajax (and why regular expressions are that beautiful...)
Julian Buss, January 2nd, 2010 11:59:30
While tinkering around with searchlotus.com I just had the problem that I use document.write() to reformat HTML produced by a Notes view. That works without any problem, until I use Ajax for lazy loading futher data from the view.Comments:
In the HTML loaded via Ajax the document.write() does not work, since the browser runs document.write() only during the intial loading of the page.
The view produces HTML like this:
(I use this to get a human friendly representation of datetime values).
I'm loading the first 10 lines of the view directly, and then I load further lines via Ajax like this:
As a result, the document.write() does not work in the HTML I loaded via dojo.xhrGet(). Luckily, we have regular expressions and eval() to the rescue!
I changes my xhrGet call to this:
and then wrote a function like this:
No Comments Found