October 2006
Intermediate to advanced
288 pages
5h 55m
English
Although we have already briefly covered the structuring of dynamic data as an XML structure to be used as an Ajax response, in this section we will focus more on the server side of the process. Responding with valid XML requires a few easy steps that can be achieved by the following instructions.
In order to specify that our data structure is XML, we must add an XML declaration to the beginning of the file that we would like to return to the client side. The following code shows an example of how to add this declaration to the structure and how to also specify the format in which the XML data should be encoded by the server.
$declaration = "<?xml version=\"1.0\" encoding=\"iso-8859-1\" ?>";
Read now
Unlock full access