AJAX Home
AJAX-TipsReturns From the Server
Category: AJAX Tips Add Comment
In our previous blog, we talked about the three commands where we could transmit information from the server to the webpage. Since Ajax doesn’t deal with the whole webpage but rather parts of it, there are special commands that should be implemented in an Ajax based website. These commands are called web remoting and the three functions are: XMLHttpRequest, IFrame and HTTP Stream. XMLHttpRequest is the most popular among the three as it’s often activated by a command from the browser. The other two are usually constant streaming of commands towards the browser, even without the command from the browser.
In this blog, we’ll be tackling the three common designs of remote calls. These are the types of transactions that usually happen in an Ajax based website. Although their behavior is not easily noticed, these operations are always there.
- Simple Call, Simple Return – the most basic of all the Ajax operation. When you create a tag in a certain picture or a file, an update is going to be created in real time. No need to refresh the webpage but a call will be made to the server to create an extension with the exact name (verbatim) as with the tag. You’ll usually find this behavior in Flickr where a tag becomes a site name if you want to share the picture to others. This simple construction of a separate URL is very simple in JavaScript but a little bit tricky since a new URL will be generated by the language.
- Simple Call, Snipet Return – in an Ajax based website for example, Gmail, the user can just type in the first three letters or more and it will auto-populate. Although it’s a very simple operation from the user’s end, it’s actually a very complicated process for most Ajax based developers. In the current version of Yahoo, the idea of suggesting possible searches also uses Ajax with a twist from Adobe’s Flex. The complicated process usually makes sure everything is easy for the user.
- Simple Call, Behavior Returned – probably the most interesting type of call in an Ajax based website. As we have indicated earlier, there is a web remoting process called HTTP Stream. Instead of a command, once the program or a website is activated in a browser, it will immediately produce a response. The response is usually a behavior or a function. Ajax based monitoring software and websites usually employ this type of behavior for a real time situation.
Why Simple Call? The term is used since all the commands that come from the browser or the program is a simple as a click or a typed in command. It’s just common sense since developers have to create a very user friendly program so that it should be accepted real easy.
These three behaviors are very common in different websites and programs as the online world is being transformed by Ajax. By getting more familiar with these functions, developers will implement their programs easier, faster and very effective.