<?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>Danny&#039;s Blog&#187; Web Design</title>
	<atom:link href="http://www.dshue.com/tag/web-design/feed" rel="self" type="application/rss+xml" />
	<link>http://www.dshue.com</link>
	<description>I can be a geek too!</description>
	<lastBuildDate>Tue, 01 Feb 2011 18:34:29 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Simple Ajax Example</title>
		<link>http://www.dshue.com/simple-ajax-example.html</link>
		<comments>http://www.dshue.com/simple-ajax-example.html#comments</comments>
		<pubDate>Tue, 22 Sep 2009 20:30:44 +0000</pubDate>
		<dc:creator>Danny</dc:creator>
				<category><![CDATA[Tech]]></category>
		<category><![CDATA[PHP]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[Web Design]]></category>

		<guid isPermaLink="false">http://www.onlyrice.com/simple-ajax-example.html</guid>
		<description><![CDATA[The Javascript: function xmlhttpPost(strURL) { var xmlHttpReq = false; var self = this; // Mozilla/Safari if (window.XMLHttpRequest) { self.xmlHttpReq = new XMLHttpRequest(); } // IE else if (window.ActiveXObject) { self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP"); } self.xmlHttpReq.open('POST', strURL, true); self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); self.xmlHttpReq.onreadystatechange = function() { if (self.xmlHttpReq.readyState == 4) { updatepage(self.xmlHttpReq.responseText); } } self.xmlHttpReq.send(getquerystring()); } function getquerystring() [...]]]></description>
			<content:encoded><![CDATA[<p><strong>The Javascript:</strong></p>
<pre class="brush:js">
<script language="Javascript">
function xmlhttpPost(strURL) {
    var xmlHttpReq = false;
    var self = this;
    // Mozilla/Safari
    if (window.XMLHttpRequest) {
        self.xmlHttpReq = new XMLHttpRequest();
    }
    // IE
    else if (window.ActiveXObject) {
        self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
    }
    self.xmlHttpReq.open('POST', strURL, true);
    self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
    self.xmlHttpReq.onreadystatechange = function() {
        if (self.xmlHttpReq.readyState == 4) {
            updatepage(self.xmlHttpReq.responseText);
        }
    }
    self.xmlHttpReq.send(getquerystring());
}

function getquerystring() {
    var form     = document.forms['f1'];
    var word = form.word.value;
    qstr = 'w=' + escape(word);  // NOTE: no '?' before querystring
    return qstr;
}

function updatepage(str){
    document.getElementById("result").innerHTML = str;
}
</script>
</pre>
<p><strong>The HTML Form :</strong></p>
<pre class="brush:html">
<form>
word:
<input name="word" type="text" />
<input onclick="JavaScript:xmlhttpPost(&quot;/cgi-bin/simple-ajax-example.cgi&quot;)" type="button" value="Go" />

<!-- The result returns in following Div tag -->
<div id="result"></div>
</form>
</pre>
<p><strong>The server side script (simple-ajax-example.cgi) :</strong></p>
<pre class="brush:perl">#!/usr/bin/perl -w

use CGI;

$query = new CGI;

$secretword = $query-&gt;param('w');

$remotehost = $query-&gt;remote_host();

print $query-&gt;header;

print "

The secret word is <strong>$secretword</strong> and your IP is <strong>$remotehost</strong>.

";</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.dshue.com/simple-ajax-example.html/feed</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

