Failing to do this can result in loss and
corruption of data.
AJAX
AJAX (Asynchronous JavaScript and XML) is a JavaScript mechanism used to
request data, normally in XML format, from which a page can be updated. We can
use AJAX in our Joomla! extensions in a bid to improve the user experience.
Joomla! does not include any support specifically for AJAX. However, Joomla! does
include the lightweight JavaScript framework, mootools. This framework includes
useful client-side features for handling AJAX.
Before we ascend into the intricacies of JavaScript, we need to look at how we deal
with an AJAX request. This might seem back to front, but it will make building the
JavaScript far easier.
Response
To send a response we need to return an XML document. To do this we must use a
component. Joomla! supports five core document response types:
Error
Feed
HTML
PDF
RAW
??? ??? ??? ??? ???
Chapter 10
[ 285 ]
XML is clearly missing from the list. This essentially leaves us with two options: we
can either create another document type, or we can use a RAW document.
Pages:
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390