There is still at least one distinct problem with the code in my examples which you should be aware of. AJAX doesn't appear to work well with sessions, at least not out of the box. If you're updating content and losing session data, don't be suprised. The easiest (or laziest) thing to do is to only work with content that doesn't rely on session data. You can read an in-depth article on the problem here: http://www.chipmunkninja.com/article/asyncsessions
If you're looking to push information to a webpage, rather than constantly polling with AJAX then there are two solutions which might interest you. Flash (actionscript) has 2 built-in capabilities: it can open XML sockets and it can call JavaScript functions. You could for example push data from an XML socket server (say, written in java) to a flash applet which can call JavaScript to update a div when it recieves data. There is also an easier way, but it's more of an ugly hack: http://www.obviously.com/tech_tips/slow_load_technique
If you're open to using third-party code to help ease development, there are many libraries available specifically for AJAX. Have a look at: http://prototype.conio.net/
Have fun.
Hi, I'm notepad.
| DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware. |