7.7 AJAX

Before going on to talk about other protocols used in mobile services, it is useful to look at another technique for improving browser-application performance, called AJAX. What AJAX does is enable part of a webpage to be updated without going back to the web server to fetch the entire updated page. Instead, a mechanism is used to fetch only the changed data and then to insert this into the page already displayed in the browser, as shown in Figure 7.23. This technique is useful for reducing latency, which is something we are sensitive to with mobile RF connections. The performance improvement is achieved in several ways. Firstly, if we only have to fetch a small amount of data versus a whole page, then we won't have to wait so long to fetch the data. Secondly, as we don't have to re-render a whole page in the browser, we won't have that delay to worry about either. This is great for the user because they continue to see the UI displayed in the browser, which gives a feeling of continuity and responsiveness to the application. Thirdly, the technique used for selective updating of the page using JavaScript isn't limited to waiting for the user to make a request. Data can be pre-fetched ahead of time. For example, if the user is browsing some kind of list (such as pop videos) we can fetch the next page of listings before the user scrolls down to view them. Furthermore, the JavaScript program that is controlling the fetching and updating can store data locally before displaying ...

Get Next Generation Wireless Applications: Creating Mobile Applications in a Web 2.0 and Mobile 2.0 World, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.