Ajax Using a Style Sheet?
Reading through Foo‘s postings, I came across this article entitled,AJAX using a stylesheet. The basic idea is that instead of using XMLHttp, hidden frames, or other such techniques, the author creates a dynamic style sheet that outputs information into the background-image
property of a hidden <div/>
. This information is then extracted using JavaScript and used for its intended purpose. Okay, so it’s possible, but the question I have is this: why?
You could just as easily change an included JavaScript file using the DOM. This would allow you to return more than just simple strings, you could return any type of JavaScript object or value. This is a case where I admire the author’s creativity, but I think the solution is better as a proof-of-concept than a practical implementation.