05 Jan 2005
Remote Scripting for Dummies
Remote scripting is the term most commonly used for getting a web page to talk to the server without refreshing the page; the most recent high-profile example is Google Suggest.
I’ve recently needed to use remote scripting in a CMS, so for any other developers due to have a dabble here are the resources I found most useful:
- Remote Scripting with IFRAME
- If you must support the widest possible range of browsers you might have to do this, but any users with that annoying browser clicking noise enabled will hear it every time data’s loaded, and it’s seemingly impossible to send data via
postwithout adding to the browser’s history (causing Back button problems). Avoid if possible.
- Dynamic HTML and XML: The XMLHttpRequest Object
- A good introduction to a more versatile and robust approach to communicating with the server, but you’ll possibly want to adapt the code after reading more elsewhere.
- XMLHttpRequest, REST and the Rich User Experience
- An example of interaction without sending/receiving XML.
- Use the XMLHttpRequest Object to Post Data
- Don’t trust the whole example (it doesn’t use the asynchronous option, for starters), just the approach to sending
encodeURIComponent()to convert values to a URL-safe encoded format.
- Using the XML HTTP Request object
- Includes a Google API example (won’t work without lowered security settings though).
- XMLHttpRequest Object Demo
- Dealing with XML sent back from the server isn’t helped by Internet Explorer’s lack of proper namespace support, but with workarounds you can do some nifty things.