<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>BLUEice studios &#187; AJAX</title>
	<atom:link href="http://www.blueicestudios.com/tag/ajax/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.blueicestudios.com</link>
	<description>Solutions for Mixed Media &#38; Web Development.</description>
	<lastBuildDate>Sat, 08 May 2010 20:43:45 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Ajax Refresh</title>
		<link>http://www.blueicestudios.com/ajax-refresh/</link>
		<comments>http://www.blueicestudios.com/ajax-refresh/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 05:26:00 +0000</pubDate>
		<dc:creator>Rob</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Code Snippets]]></category>
		<category><![CDATA[Featured Articles]]></category>

		<guid isPermaLink="false">http://www.blueicestudios.com/?p=173</guid>
		<description><![CDATA[Div Refreshing with Ajax.


function createRequestObject() {

   var req;

   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
 [...]]]></description>
			<content:encoded><![CDATA[<p>Div Refreshing with Ajax.</p>
<pre class="brush:js">

function createRequestObject() {

   var req;

   if(window.XMLHttpRequest){
      // Firefox, Safari, Opera...
      req = new XMLHttpRequest();
   } else if(window.ActiveXObject) {
      // Internet Explorer 5+
      req = new ActiveXObject("Microsoft.XMLHTTP");
   } else {
      // There is an error creating the object,
      // just as an old browser is being used.
     alert("Your Browser Does Not Support This Script - Please Upgrade Your Browser ASAP");
   }

   return req;

}

// Make the XMLHttpRequest object
var http = createRequestObject();

function sendRequest(page) {

   // Open PHP script for requests
   http.open('get', page);
   http.onreadystatechange = handleResponse;
   http.send(null);

}

function handleResponse() {

   if(http.readyState == 4 &#038;&#038; http.status == 200){

      // Text returned FROM the PHP script
      var response = http.responseText;

      if(response) {
         // UPDATE ajaxTest content
         document.getElementById("div id").innerHTML = response;
      }

   }

}

function repeatloop()
{
sendRequest('page.php');
setTimeout("repeatloop()", 2000);
}

window.onload=function() {
repeatloop();
}
</pre>
<p>div id is the div in which the page is loaded.<br />
edit &#8220;page.php&#8221; as the page to load.<br />
change the timeout to your liking. 2000 is 2 seconds.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.blueicestudios.com/ajax-refresh/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
