< Prev :Contents: Next >

Request by scripts

For requests made by scripts, the story is different. The user may or may not do anything. The script is responsibel for  invoking the request, and for handling the response. Again, this request can be of two types: synchronous and asynchronous. If a request is made in synchronous mode, the invoking function or script blocks (waits) till a response or error is received. Most browsers are unresponsive when there is a script running, till it completes. If the script takes long to complete, the browser might show a warning showing that the script in the page is unresponsive, and giving the user an option to abort the script.

The other method, the asynchronous mode, is the way that has been the favourite of web developers for some time now. It allows for sending out multiple requests, and also a way to send requests without blocking (waiting) for response. This is what makes it very attractive. The user can continue doing his / her work during that time. The applications are many. I give one example: the auto suggest feature in current day search engines, Google Suggest, etc. Try it out yourself: Go to http://search.yahoo.com, and type in a long word. For example, try "floccinau", And wait for a few seconds (in a JavaScript enabled browser when internet connection is enabled). You will see that the page comes up with suggestions. Another example, goto http://search.yahoo.com/instant, and type in something to search. If there are any results in Yahoo, it will be shown immediatly in a balloon below. What happened behind the scenes was an Ajax request, sending the letters you typed. And the response that came are the words that you see in the box below.

Creative Commons License This work is licenced under a Creative Commons Licence. More details in the content page.

< Prev :Contents: Next >