<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: jXHR: XHR API, JSON-P backend conduit</title>
	<atom:link href="http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/feed" rel="self" type="application/rss+xml" />
	<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit</link>
	<description>Cleaning up the web with Ajax</description>
	<lastBuildDate>Thu, 09 Feb 2012 06:55:33 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: Merl</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-285835</link>
		<dc:creator>Merl</dc:creator>
		<pubDate>Thu, 07 Jul 2011 19:50:01 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-285835</guid>
		<description>one problem for dynamic script loading is that you do not get XHR response.status from the server, so no way to check for 404 or 500.  if you have an invalid url, you never get the publicAPI.onerror handler.

distinct from publicAPI.onerror, with HTML5 ( http://bit.ly/qb5GfU ; see item #14), you can define scriptElem.onerror for any type of error loading the script.  

i added this mod to your script to handle invalid url errors:

after handleScriptLoad

	// MOD: added handleScriptFail()
	function handleScriptFail() {
		if (!script_loaded) {
			ThrowError(&quot;Script failed to load [&quot;+script_url+&quot;], most probably due to an invalid URL or server error.&quot;)
		}
	}


inside send:

// P4 MOD: added onerror
	scriptElem.onerror = function() {
		handleScriptFail.call(scriptElem);
	};</description>
		<content:encoded><![CDATA[<p>one problem for dynamic script loading is that you do not get XHR response.status from the server, so no way to check for 404 or 500.  if you have an invalid url, you never get the publicAPI.onerror handler.</p>
<p>distinct from publicAPI.onerror, with HTML5 ( <a href="http://bit.ly/qb5GfU" rel="nofollow">http://bit.ly/qb5GfU</a> ; see item #14), you can define scriptElem.onerror for any type of error loading the script.  </p>
<p>i added this mod to your script to handle invalid url errors:</p>
<p>after handleScriptLoad</p>
<p>	// MOD: added handleScriptFail()<br />
	function handleScriptFail() {<br />
		if (!script_loaded) {<br />
			ThrowError(&#8220;Script failed to load ["+script_url+"], most probably due to an invalid URL or server error.&#8221;)<br />
		}<br />
	}</p>
<p>inside send:</p>
<p>// P4 MOD: added onerror<br />
	scriptElem.onerror = function() {<br />
		handleScriptFail.call(scriptElem);<br />
	};</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275503</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Thu, 17 Sep 2009 00:10:26 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275503</guid>
		<description>@stimpy77 -- i think you&#039;ve actually hit on exactly why I think that standardizing on the same API is important... so that it&#039;s easy to swap in optional implementations depending on technical environment but without having to code more complex code that makes calls differently. When it&#039;s the same (or nearly the same) API, it greatly simplifies that kind of usage. And that&#039;s my goal, to provide more options for cross-domain Ajax, but without fragmenting the API into an unmanageable mess.</description>
		<content:encoded><![CDATA[<p>@stimpy77 &#8212; i think you&#8217;ve actually hit on exactly why I think that standardizing on the same API is important&#8230; so that it&#8217;s easy to swap in optional implementations depending on technical environment but without having to code more complex code that makes calls differently. When it&#8217;s the same (or nearly the same) API, it greatly simplifies that kind of usage. And that&#8217;s my goal, to provide more options for cross-domain Ajax, but without fragmenting the API into an unmanageable mess.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: stimpy77</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275295</link>
		<dc:creator>stimpy77</dc:creator>
		<pubDate>Sat, 29 Aug 2009 20:24:16 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275295</guid>
		<description>I think this API would be interesting if its intent was to be a fallback API rather than a &quot;similar syntax&quot;. So if a browser supports the new standard, it uses that, but if it doesn&#039;t, it uses JSONP, either way no manual toggling involved for the developer.</description>
		<content:encoded><![CDATA[<p>I think this API would be interesting if its intent was to be a fallback API rather than a &#8220;similar syntax&#8221;. So if a browser supports the new standard, it uses that, but if it doesn&#8217;t, it uses JSONP, either way no manual toggling involved for the developer.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275157</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Thu, 20 Aug 2009 22:17:06 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275157</guid>
		<description>good catch, thank you @checkca. Will fix ASAP.</description>
		<content:encoded><![CDATA[<p>good catch, thank you @checkca. Will fix ASAP.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: checkca</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275156</link>
		<dc:creator>checkca</dc:creator>
		<pubDate>Thu, 20 Aug 2009 22:14:46 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275156</guid>
		<description>I love mullet !

BTW, it seems that &quot;internal_callback&quot; variable is global...</description>
		<content:encoded><![CDATA[<p>I love mullet !</p>
<p>BTW, it seems that &#8220;internal_callback&#8221; variable is global&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Jadet</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275155</link>
		<dc:creator>Jadet</dc:creator>
		<pubDate>Thu, 20 Aug 2009 19:49:20 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275155</guid>
		<description>hehe awesome</description>
		<content:encoded><![CDATA[<p>hehe awesome</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275154</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Thu, 20 Aug 2009 19:13:41 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275154</guid>
		<description>BTW, in honor of Dion&#039;s awesome picture to visualize my API, this project can now be located at:

http://mullet.xhr.me

http://mulletxhr.com</description>
		<content:encoded><![CDATA[<p>BTW, in honor of Dion&#8217;s awesome picture to visualize my API, this project can now be located at:</p>
<p><a href="http://mullet.xhr.me" rel="nofollow">http://mullet.xhr.me</a></p>
<p><a href="http://mulletxhr.com" rel="nofollow">http://mulletxhr.com</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marlonbtx</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275153</link>
		<dc:creator>marlonbtx</dc:creator>
		<pubDate>Thu, 20 Aug 2009 17:06:15 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275153</guid>
		<description>so you are not using an iframe! you use script tag</description>
		<content:encoded><![CDATA[<p>so you are not using an iframe! you use script tag</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: marlonbtx</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275151</link>
		<dc:creator>marlonbtx</dc:creator>
		<pubDate>Thu, 20 Aug 2009 17:02:24 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275151</guid>
		<description>lol funny pic</description>
		<content:encoded><![CDATA[<p>lol funny pic</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275147</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Thu, 20 Aug 2009 13:52:13 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275147</guid>
		<description>The main point of jXHR, besides putting the familiar and well-known XHR API wrapper on top of dynamic-script-tag JSON-P calls, was to provide the &quot;onerror&quot; error detection handler functionality.

If you set &quot;onerror&quot; handler, and your JSON-P call fails for some reason, then you&#039;ll be immediately notified, rather than needing to do your own timer detection, etc.

Also, jXHR is less than 700 bytes when minified and gzip&#039;d, so it&#039;s really small and easy to use just about anywhere, including bookmarklets, cross-domain widgets, etc.</description>
		<content:encoded><![CDATA[<p>The main point of jXHR, besides putting the familiar and well-known XHR API wrapper on top of dynamic-script-tag JSON-P calls, was to provide the &#8220;onerror&#8221; error detection handler functionality.</p>
<p>If you set &#8220;onerror&#8221; handler, and your JSON-P call fails for some reason, then you&#8217;ll be immediately notified, rather than needing to do your own timer detection, etc.</p>
<p>Also, jXHR is less than 700 bytes when minified and gzip&#8217;d, so it&#8217;s really small and easy to use just about anywhere, including bookmarklets, cross-domain widgets, etc.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: shadedecho</title>
		<link>http://ajaxian.com/archives/jxhr-xhr-api-json-p-backend-conduit/comment-page-1#comment-275146</link>
		<dc:creator>shadedecho</dc:creator>
		<pubDate>Thu, 20 Aug 2009 13:39:33 +0000</pubDate>
		<guid isPermaLink="false">http://ajaxian.com/?p=7263#comment-275146</guid>
		<description>For the record, that is NOT a picture of me. :) But funny picture nonetheless, Dion. :)</description>
		<content:encoded><![CDATA[<p>For the record, that is NOT a picture of me. :) But funny picture nonetheless, Dion. :)</p>
]]></content:encoded>
	</item>
</channel>
</rss>

