Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
Spry User Guide - Support - Adobe
Create successful ePaper yourself
Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.
<br />
<br />
<br />
Dynamic Region Example<br />
<br />
<br />
<br />
var dsPhotos = new <strong>Spry</strong>.Data.XMLDataSet("/photos.php", "/gallery/photos/photo", {<br />
method: "POST", postData: "galleryid=2000&offset=20&limit=10", headers: { "Content-Type":<br />
"application/x-www-form-urlencoded; charset=UTF-8" } });<br />
<br />
<br />
. . .<br />
<br />
<br />
<br />
If you use the POST method, but don’t specify a content type, the default content type is set to "application/xwww-form-urlencoded;<br />
charset=UTF-8".<br />
The following table shows the HTTP-related constructor options that you can specify.<br />
Option Description<br />
method The HTTP method to use when fetching the XML data. Must be the string "GET" or "POST".<br />
postData Can be a string containing url encode form arguments or any value supported by the<br />
XMLHttpRequest object. If a "Content-Type" header is not specified in conjunction with the<br />
postData option, the "application/x-www-form-urlencoded;<br />
charset=UTF-8" content type is used.<br />
username The server username to use when accessing the XML data.<br />
password The password to use in conjunction with username when accessing the XML data.<br />
headers An object or associative array that uses the HTTP request field name as its property and key<br />
to store values.<br />
Turn off data caching<br />
By default, <strong>Spry</strong> caches any XML datathat a data set loaded on the client. If a data set attempts to load the XML data<br />
for a given URL that is already in the cache, <strong>Spry</strong> returns a reference to the cached data to the data set. If multiple<br />
data sets attempt to load the same URL at the same time, all load requests are combined into a single HTTP request<br />
to save bandwidth.<br />
Use of data caching and of combining requests can greatly improve performance, especially when multiple data sets<br />
refer to the same XML data; at times you might need to load the data directly from the server (for example, if you<br />
have a URL that might return different data each time someone accesses it).<br />
❖ To force a data set to load XML data directly from the server, set the useCache XMLDataSet constructor option<br />
to false, as follows:<br />
var dsPhotos = new <strong>Spry</strong>.Data.XMLDataSet("/photos.php?galleryid=2000",<br />
"/gallery/photos/photo", {useCache: false })<br />
SPRY<br />
<strong>User</strong> <strong>Guide</strong><br />
122