<?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>Working Beta &#187; Prototype</title>
	<atom:link href="http://seeds.workingbeta.com/tag/prototype/feed/" rel="self" type="application/rss+xml" />
	<link>http://seeds.workingbeta.com</link>
	<description>a bounch of nearly working code</description>
	<lastBuildDate>Wed, 10 Feb 2010 21:25:11 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>fast IFRAME-like ajax implementation</title>
		<link>http://seeds.workingbeta.com/2008/11/19/fast-iframe-like-ajax-implementation/</link>
		<comments>http://seeds.workingbeta.com/2008/11/19/fast-iframe-like-ajax-implementation/#comments</comments>
		<pubDate>Wed, 19 Nov 2008 14:57:52 +0000</pubDate>
		<dc:creator>gc</dc:creator>
				<category><![CDATA[AJAX]]></category>
		<category><![CDATA[Javascript]]></category>
		<category><![CDATA[Prototype]]></category>
		<category><![CDATA[events]]></category>

		<guid isPermaLink="false">http://seeds.workingbeta.com/?p=23</guid>
		<description><![CDATA[Yes, whe know, W3C specs garbaged all the nice IFRAMES that fitted so nicely in our pages. Ajax helped a lot but even if you used Prototye or some other ajax flavoured framework there was soo much work to do; each single link needed an event listener, some tweaking and so on.
After messing up with [...]]]></description>
			<content:encoded><![CDATA[<p>Yes, whe know, W3C specs garbaged all the nice IFRAMES that fitted so nicely in our pages. Ajax helped a lot but even if you used Prototye or some other ajax flavoured framework there was soo much work to do; each single link needed an event listener, some tweaking and so on.</p>
<p>After messing up with some application requiring a huge number of ajax calls, I ended up thinking about this little piece of code:</p>
<blockquote>
<p><code></p>
<p>window.onload=function(){<br />
Event.observe(document.body, 'click', function(event) {<br />
&nbsp;&nbsp;&nbsp;&nbsp;var element = Event.element(event);<br />
&nbsp;&nbsp;&nbsp;&nbsp;if ('A' == element.tagName){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;if ($(element.target) != undefined){<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;new Ajax.Updater(element.target,element.href,<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;{method:"post",evalscripts:true})<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;Event.stop(event);<br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;}<br />
&nbsp;&nbsp;&nbsp;&nbsp;});<br />
}</code></p>
</blockquote>
<p>basically, this 10-line worth trick sets an event listener on every click. If   you click on a &#8216;a&#8217; with a target attribute set up, it starts an Ajax.Updater call on it.<br />
you can of course add GET parameters and feed .php, and of course javascript code is parsed as well..<br />
the complete seed [just a .htm and .php example file added] can be downloaded <a href="http://workingbeta.com/seeds/fastAjax.zip">here</a></p>
]]></content:encoded>
			<wfw:commentRss>http://seeds.workingbeta.com/2008/11/19/fast-iframe-like-ajax-implementation/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>
