<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://wiki.freedesk.purplepixie.org/w/skins/common/feed.css?303"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en-gb">
		<id>http://wiki.freedesk.purplepixie.org/w/index.php?action=history&amp;feed=atom&amp;title=JS_ServerRequest</id>
		<title>JS ServerRequest - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.freedesk.purplepixie.org/w/index.php?action=history&amp;feed=atom&amp;title=JS_ServerRequest"/>
		<link rel="alternate" type="text/html" href="http://wiki.freedesk.purplepixie.org/w/index.php?title=JS_ServerRequest&amp;action=history"/>
		<updated>2026-05-12T21:19:27Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.19.0</generator>

	<entry>
		<id>http://wiki.freedesk.purplepixie.org/w/index.php?title=JS_ServerRequest&amp;diff=24&amp;oldid=prev</id>
		<title>Dave: Created page with &quot;= Overview =  The ServerRequest Javascript class provides a common AJAX framework for all FreeDESK components.  = Example =  The following is a commented example to demonstrat...&quot;</title>
		<link rel="alternate" type="text/html" href="http://wiki.freedesk.purplepixie.org/w/index.php?title=JS_ServerRequest&amp;diff=24&amp;oldid=prev"/>
				<updated>2012-06-27T23:17:55Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;= Overview =  The ServerRequest Javascript class provides a common AJAX framework for all FreeDESK components.  = Example =  The following is a commented example to demonstrat...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;= Overview =&lt;br /&gt;
&lt;br /&gt;
The ServerRequest Javascript class provides a common AJAX framework for all FreeDESK components.&lt;br /&gt;
&lt;br /&gt;
= Example =&lt;br /&gt;
&lt;br /&gt;
The following is a commented example to demonstrate it's use:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;javascript&amp;quot;&amp;gt;&lt;br /&gt;
function myCallback(xml, additional) // this function deals with our results&lt;br /&gt;
{&lt;br /&gt;
 // do nothing... just an example...&lt;br /&gt;
 // but here we could process the xml and any additional values passed&lt;br /&gt;
}&lt;br /&gt;
&lt;br /&gt;
// Make a new ServerRequest&lt;br /&gt;
var sr = new ServerRequest();&lt;br /&gt;
&lt;br /&gt;
// Now let's set some options...&lt;br /&gt;
sr.xmlrequest = true; // Is it an XML or HTML request (the type of data coming back, the default is XML but we'll set it anyway)&lt;br /&gt;
sr.async = true; // Asynchronous or synchronous request (default is async but will set again for example)&lt;br /&gt;
sr.randomise = true; // Append a random string to a GET request to avoid caching (again default is true)&lt;br /&gt;
&lt;br /&gt;
// And for the actual call...&lt;br /&gt;
sr.url = &amp;quot;somepage.php?opt1=A&amp;amp;opt2=B&amp;quot;; // Our URL including query string&lt;br /&gt;
sr.callback = myCallback; // Our callback function&lt;br /&gt;
sr.additional[0] = 1; // We can set the additional data which is an Array and will also be passed to myCallback&lt;br /&gt;
&lt;br /&gt;
// And perform the request...&lt;br /&gt;
sr.Get(); // do a Get request as setup&lt;br /&gt;
&lt;br /&gt;
// This should have done a GET request and then (if no error occured) gone to myCallback with the resultant XML and also the additional data we set.&lt;br /&gt;
&lt;br /&gt;
// Now for a POST example...&lt;br /&gt;
var asr = new ServerRequest();&lt;br /&gt;
asr.url = &amp;quot;somepage.php&amp;quot;; // just the page this time no query GET data&lt;br /&gt;
var data = &amp;quot;opt1=A&amp;amp;opt2=B&amp;quot;; // our URI-encoded data for the POST&lt;br /&gt;
asr.callback = myCallback;&lt;br /&gt;
asr.additional[0] = 1;&lt;br /&gt;
&lt;br /&gt;
// All setup now the POST&lt;br /&gt;
asr.Post(data); // pass the URI encoded data&lt;br /&gt;
&lt;br /&gt;
// And again we should go back to myCallback the same as before&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;/div&gt;</summary>
		<author><name>Dave</name></author>	</entry>

	</feed>