<?xml version="1.0" encoding="UTF-8"?>
<!-- generator="wordpress/2.8.4" -->
<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/"
	>

<channel>
	<title>http://blog.sLajax.com</title>
	<link>http://blog.slajax.com</link>
	<description>secure lightweight ajax solutions</description>
	<pubDate>Wed, 16 Dec 2009 07:39:40 +0000</pubDate>
	<generator>http://wordpress.org/?v=2.8.4</generator>
	<language>en</language>
			<item>
		<title>Javascript Cross Domain Ajax</title>
		<link>http://blog.slajax.com/2008/07/23/javascript-cross-domain-ajax/</link>
        <customfield>dojo.png</customfield>
		<comments>http://blog.slajax.com/2008/07/23/javascript-cross-domain-ajax/#comments</comments>
		<pubDate>Wed, 23 Jul 2008 17:16:23 +0000</pubDate>
		<dc:creator>Kyle</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[blast radius]]></category>
		<category><![CDATA[frameworks]]></category>
		<category><![CDATA[javascript]]></category>
		<category><![CDATA[crossdomain]]></category>
		<category><![CDATA[http]]></category>
		<category><![CDATA[mashup]]></category>
		<category><![CDATA[x-domain]]></category>

		<guid isPermaLink="false">http://blog.slajax.com/?p=32</guid>
		<description><![CDATA[Since I joined Blast Radius [1] I have been introduced to a lot of new and interesting development practices, frameworks and designs that I have always read or heard about, but was never really forced or motivated to imply in my daily progression.
One such framework I wrote briefly about is Mojo [2]. Being a framework that has evolved from the Dojo Toolkit [3] my interest peaked this morning when I read a very interesting article on Ajaxian [4] about cross domain transport.


Originally as more of a low level technologist who only picked up ajax and interface development as a smooth view state for communicating with my middle tier controllers I found Javascript to be very much lacking the web services department. Very often the techniques that have been traditionally used consist of one of two strategies for x-domain communication;

1- A remote javascript include is served using:



[1] http://blog.slajax.com/2008/06/17/relocating-to-vancouver-senior-interface-developer/
[2] http://blog.slajax.com/2008/07/17/first-week-at-blast-radius-over/
[3] http://dojotoolkit.com
[4] http://ajaxian.com/archives/windowname-meet-dojoxiowindowname]]></description>
			<content:encoded><![CDATA[Since I <a href="http://blog.slajax.com/2008/06/17/relocating-to-vancouver-senior-interface-developer/" target="_blank">joined Blast Radius</a> I have been introduced to a lot of new and interesting development practices, frameworks and designs that I have always read or heard about, but was never really forced or motivated to imply in my daily progression.
One such framework I wrote briefly about is <a href="http://blog.slajax.com/2008/07/17/first-week-at-blast-radius-over/"  target="_blank">Mojo</a>. Being a framework that has evolved from the <a href="http://dojotoolkit.com"  target="_blank">Dojo Toolkit</a> my interest peaked this morning when I read a very interesting article on <a href="http://ajaxian.com/archives/windowname-meet-dojoxiowindowname" target="_blank">Ajaxian</a> about cross domain transport.
<br/><br/>

Originally as more of a low level technologist who only picked up ajax and interface development as a smooth view state for communicating with my middle tier controllers I found Javascript to be very much lacking the web services department. Very often the techniques that have been traditionally used consist of one of two strategies for x-domain communication;
<br/><br/>
1- <strong>A remote javascript include is served using:</strong><br/>
<div class='codeWrapper'><div class='codeTitle'>javascript<span class='codeInstruct'>hover edges to scroll</span></div><code><pre>&nbsp;
&lt;script type=<span style="color: #3366CC;">'text/javascript href='</span>http:<span style="color: #009900; font-style: italic;">//remotehost/js/api.js?param=1&amp;param2'&gt;</span></pre></code></div>
This is usually a server side script that generates the file contents based on the parameters, and then either renders content locally into your DOM, or provides you with a set of methods that will allow you to manipulate the content. This is not a very secure model and does not allow you to interact with raw xml data very robustly, but as long as you trust the source that is rending the content, it is quite efficient.
<br/><br/>
2- <strong>By matter of Proxy.</strong><br/>
This method I&#8217;ve used very often for direct communication with XML, SOAP, or REST gateways. Generally, I will develop the interface layer to communicate with a server side controller which will then use Curl to invoke the remote data, process and return as an JSON object. I find this method to be very robust, and allows you to create a very extensible gateway for your Javascript cross domain requests.
<br/><br/>

With that said, the post I read this morning is indicating that a new methodology for cross-domain scripting is emerging in the Dojo framework. By way of the property <i>window.name</i> one can make a remote request and retrieve data without exploiting the ever so wonderful cross domain security model that we are subject to in all our favorite browsers. This concept is very new but interesting. It opens up a whole new world of client side mash-up possibilities that are sure to get the creative juices flowing in the client side development space. Here is an example of it would be implemented:

<div class='codeWrapper'><div class='codeTitle'>javascript<span class='codeInstruct'>hover edges to scroll</span></div><code><pre>&nbsp;
dojox.<span style="color: #006600;">io</span>.<span style="color: #006600;">windowName</span>.<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span>method, args<span style="color: #66cc66;">&#41;</span>; <span style="color: #009900; font-style: italic;">// simple method</span>
<span style="color: #009900; font-style: italic;">// deferred result</span>
&nbsp;
<span style="color: #003366; font-weight: bold;">var</span> deferred = dojox.<span style="color: #006600;">io</span>.<span style="color: #006600;">windowName</span>.<span style="color: #006600;">send</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"GET"</span>, <span style="color: #66cc66;">&#123;</span>url:<span style="color: #3366CC;">"http://somesite.com/resource"</span><span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;
deferred.<span style="color: #006600;">addCallback</span><span style="color: #66cc66;">&#40;</span><span style="color: #003366; font-weight: bold;">function</span><span style="color: #66cc66;">&#40;</span>result<span style="color: #66cc66;">&#41;</span><span style="color: #66cc66;">&#123;</span>
  <span style="color: #000066;">alert</span><span style="color: #66cc66;">&#40;</span><span style="color: #3366CC;">"The request returned "</span> + result<span style="color: #66cc66;">&#41;</span>;
<span style="color: #66cc66;">&#125;</span><span style="color: #66cc66;">&#41;</span>;</pre></code></div>


]]></content:encoded>
			<wfw:commentRss>http://blog.slajax.com/2008/07/23/javascript-cross-domain-ajax/feed/</wfw:commentRss>
		</item>
	</channel>
</rss>
