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.

Disclaimer: Any viewpoints and opinions expressed in this article are those of Nicholas C. Zakas and do not, in any way, reflect those of my employer, my colleagues, Wrox Publishing, O'Reilly Publishing, or anyone else. I speak only for myself, not for them.

Both comments and pings are currently closed.