Support for AJAX and the XMLHttpRequest object

The BlackBerry® Browser introduced support for the XMLHttpRequest object in BlackBerry® Device Software version 4.6. You can use the XMLHttpRequest object to transfer data between the BlackBerry Browser and the web server without reloading the entire web page. You can use this object to send and retrieve XML, HTML, plain text, or other data types in the background. Because access to the DOM is also available, you can update the web page when new data or content is retrieved to create extremely responsive and dynamic web pages.

The BlackBerry Browser supports synchronous requests (the JavaScript® engine is blocked until it receives a response from the server) and asynchronous requests (the JavaScript engine can process other JavaScript functions while it awaits a response). However, because of the slower data transfer rates in a wireless browsing environment, requests made by this object should almost always be asynchronous.

The XMLHttpRequest object can help to reduce the perceived latency that marks wireless browsing. Because requests are made in the background, the user can continue to work with the current web page while new data is retrieved. Because smaller amounts of data are parsed, the BlackBerry Browser can render modifications to the web page quickly.


Was this information helpful? Send us your comments.