AJAX-Tips Tutorials
AJAX-TipsAvoiding Programming Pitfalls in Ajax
Developing Ajax is always a form of art. A highly intricate programming technique, a well formed Ajax based application could amaze millions of users without a single glitch. The thrust of Web 2.0 and RIA has elevated Ajax as the next development language to be learned. At the same time, Ajax is also a science. Although it has the freedom to reach other to other languages, it has parameters of development. The options are still almost unlimited as developers come up with revolutionary ideas from time to time.
However there are limits to the things we can perform with Ajax. It is not about the creativity but in terms of providing secure and effective applications to users. Here are some of the notable programming pitfalls that will cost the application to be exposed in various ways:
Exposing the Server – As the server and client side interaction is very dynamic and constant; there is always the possibility that too much information about the server is exposed to the user. This situation is especially noticed in remote frameworks. A good example is SAJAX. Remotely controlling JavaScript with another language enables the developers to build applications without the knowledge of JS but the communication could be easily intercepted and be used to access the server. Common JavaScript functions could be easily identified and remote control frameworks of these functions are already familiar to hackers everywhere.
Changing DOM after the initial call – Developers always has the option in changing DOM objects after the call so that the response will be customized. Instead of receiving a direct response the information is sent to another function for a totally separate execution. While this is possible, it presents a risk in the general development of your application. The server response or the data that will be coming with it might be inappropriate. It could also be that the information will be sent back to the same DOM which should not be the case. Developers should double check their DOM function especially when they want to customize their response from the server.
Expected Call Return – A call is made with a response as a result. However due to some error it is possible that the response will never arrive. Without proper handling, the program might just be left hanging without any plans for the next action. To handle this, developers should install timers to give the function call enough time to wait for the response. If call fails to have a return, it should be able to inform the server for an alternate action or just completely return with an error.
Call Error Status
Sponsored Links
