How Ajax Can Become as User Friendly as Flash
There are a number of reasons why Flash has become so popular on the web today, and this lies in the fact that users don’t have to reload the page. Products such as Flash Remoting will allow users to access the background server, and Ajax can do the same thing with HTML.
Systems such as CFAJAX will allow users to send out complex objects, but it is difficult to receive and understand them, especially if you are using products such as ColdFusion. To solve this problem, some developers have come up with a solution known as WDDX serialization.
In case you are not familiar with the term, WDDX stands from Web Development Data Exchange. It was designed in 2001 for the purpose to handling problems that occured with the exchange of data among web applications. In the most basic sense, WDDX is a system that will assist in the transfer of complex objects among XML. This system will support things such as numbers, strings, and arrays. The modules within WDDX will have a support for a number of different languages. It will even support ColdFusion, though in a limited manner. The languages for which it offers a great deal of support are Java, ASP, JavaScript, and PHP.
However, being familiar with the definition of WDDX won’t allow you to fully understand why it is useful. There are a number of online tutorials which will show you complex objects that have been generated within JavaScript. These objects will typically be comprised of an array of different units. Before it can be sent to ColdFusion, it must first be serialized. To do this, you will need to create a fresh WDDX serializer, and then you will have to serialize the object.
This is a fairly simple process, and users will not be required to understand the underlying structure of the packet. Some tutorials online will also walk you through the process of receiving the call.
The function will only require a single argument, and this is the WDDX packet. It is important for you to realize that this packet isn’t an object. Instead, it is an XML object or string. It will be returned intact, and this will allow you to see what goes on behind the scenes.
The callback function can be used to alert the packet that is being returned. If you look at some of the examples on the web, you will see that the XML string must be alerted by using a function called the testResult function. There are a number of tricks developers can use to make Ajax as user friendly as Flash. The first deals heavily with multiple browsers.
Developers will want to pay close attention to the URLDecode function. This function should be available in the ColdFusion listener. If you fail to use it, the code will work well with browsers such as Firefox and Internet Explorer, but it will not work for those using Safari. Many developers have learned this the hard way.
I’am not certain of why the code will not work with Safari, but it seems that it encodes the XML packet before it can be sent, and ColdFusion does not have the ability to decode it. As you can see, this makes it next to impossible to de-serialize the argument. Before you go live with the project, it is critical for you to test it in a variety of different environments.
If you do this, you may find that time is saved on the debugging process. Another process that developers will want to deal with is the login. This can be done properly with the right debugging techniques. There will be times where the user will navigate the site, and they may be allowed to log in with a form that is frequently available to them.
This will generally be at the top navigation menu. In some cases the user will simply post a form, and they may then decide to log in. While there may be no problems with this, problems could occur if you allow the user to add just the log in form. The reason for this is because you could lose variable for your other forms. One solution that many developers use is to create a loop though the group of forms to generate hidden fields. However, this may only work in some instances.