|
One of the things that has amazed me about all these Ajax posts is that everyone is writing (or attempting to write) the client-side javascript code themselves. WHY? There are many script libraries out there that have written the code (and tested it against many browsers) making it much more elegant, and simpler to program. Why are people reinventing the wheel? I'm partial to prototype from http://prototype.conio.net but use what you like. For example. Say you wanted to update a div tag with the result from a Ajax call to the server. Simple include the prototype.js file in your HEAD code via: <script src="/js/prototype.js"></script> And then the COMPLETE js you need to write would be: new Ajax.Updater("ID-Of-Div", "/URL/Of/Page"); That's it! One line! The Updater method will handle creating the XMLHTTPRequest object as needed by the browser, create the callback functions for the object, launch the request, process the response and update the innerHTML of the div with the specified id. Not only is it simpler to code, but it's significantly less code to send over the pipe to the client. -Walden
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.