<?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: Cross-domain requests with jQuery</title>
	<atom:link href="http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/feed/" rel="self" type="application/rss+xml" />
	<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Thu, 02 Feb 2012 18:03:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2</generator>
	<item>
		<title>By: Sebastian</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29990</link>
		<dc:creator>Sebastian</dc:creator>
		<pubDate>Sat, 18 Sep 2010 00:32:19 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29990</guid>
		<description>@James
When I change google.com to facebook.com in the jQuery.ajax function you give in your examples and tests I get an error in my console, that is data.results[0] is undefined. Can someone please give me some advice with this? Here is the code snippet:

&lt;code&gt;
$.ajax({
            type: &#039;GET&#039;,
            url: &#039;http://www.facebook.com&#039;,
            success: function(html){
                process(html);
            },
            error: function(){
                debug(&quot;ajax error&quot;);
            }
        }); 
{/code}</description>
		<content:encoded><![CDATA[<p>@James<br />
When I change google.com to facebook.com in the jQuery.ajax function you give in your examples and tests I get an error in my console, that is data.results[0] is undefined. Can someone please give me some advice with this? Here is the code snippet:</p>
<p><code><br />
$.ajax({<br />
            type: 'GET',<br />
            url: '<a href="http://www.facebook.com&#039;">http://www.facebook.com&#039;</a>,<br />
            success: function(html){<br />
                process(html);<br />
            },<br />
            error: function(){<br />
                debug("ajax error");<br />
            }<br />
        });<br />
{/code}</code></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: intsam</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29986</link>
		<dc:creator>intsam</dc:creator>
		<pubDate>Fri, 17 Sep 2010 19:20:59 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29986</guid>
		<description>Great solution for the cross domain issue. But it didn&#039;t work for some URLs. This URL that I&#039;m trying to load contains most of the dynamic content instead of static. Don&#039;t know if it&#039;s the issue. And the other problem is this didn&#039;t work for me in IE. Worked perfectly in Firefox. Is YQL is browser dependent?</description>
		<content:encoded><![CDATA[<p>Great solution for the cross domain issue. But it didn&#8217;t work for some URLs. This URL that I&#8217;m trying to load contains most of the dynamic content instead of static. Don&#8217;t know if it&#8217;s the issue. And the other problem is this didn&#8217;t work for me in IE. Worked perfectly in Firefox. Is YQL is browser dependent?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Marius</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29880</link>
		<dc:creator>Marius</dc:creator>
		<pubDate>Thu, 09 Sep 2010 14:18:34 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29880</guid>
		<description>data.results[0] is undefined, in firebug console.
- any clue what am I doing wrong ?</description>
		<content:encoded><![CDATA[<p>data.results[0] is undefined, in firebug console.<br />
- any clue what am I doing wrong ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: James</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29788</link>
		<dc:creator>James</dc:creator>
		<pubDate>Wed, 01 Sep 2010 11:34:51 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29788</guid>
		<description>Hey I&#039;m getting a strange error:

&lt;code&gt;Uncaught ReferenceError: jsonp1283340405175 is not defined&lt;/code&gt;

Any ideas? Seems like the JSON is not being parsed correctly?

Here&#039;s my ajax request;

&lt;pre lang=&quot;javascript&quot;&gt;
$.ajax({
    url: &quot;http://userscripts.org/scripts/show/81657&quot;,
    type: &quot;GET&quot;,
    success: function(res) {
        var ver = $(res.responseText).find(&#039;#summary&#039;).text().match(/\[v([0-9.]+)\]/);
        console.info(ver, &quot;versus&quot;, version);
    }
});
&lt;/pre&gt;</description>
		<content:encoded><![CDATA[<p>Hey I&#8217;m getting a strange error:</p>
<p><code>Uncaught ReferenceError: jsonp1283340405175 is not defined</code></p>
<p>Any ideas? Seems like the JSON is not being parsed correctly?</p>
<p>Here&#8217;s my ajax request;</p>

<div class="wp_syntax"><div class="code"><pre class="javascript" style="font-family:monospace;">$.<span class="me1">ajax</span><span class="br0">&#40;</span><span class="br0">&#123;</span>
    url<span class="sy0">:</span> <span class="st0">&quot;http://userscripts.org/scripts/show/81657&quot;</span><span class="sy0">,</span>
    type<span class="sy0">:</span> <span class="st0">&quot;GET&quot;</span><span class="sy0">,</span>
    success<span class="sy0">:</span> <span class="kw2">function</span><span class="br0">&#40;</span>res<span class="br0">&#41;</span> <span class="br0">&#123;</span>
        <span class="kw2">var</span> ver <span class="sy0">=</span> $<span class="br0">&#40;</span>res.<span class="me1">responseText</span><span class="br0">&#41;</span>.<span class="me1">find</span><span class="br0">&#40;</span><span class="st0">'#summary'</span><span class="br0">&#41;</span>.<span class="me1">text</span><span class="br0">&#40;</span><span class="br0">&#41;</span>.<span class="me1">match</span><span class="br0">&#40;</span><span class="co2">/\[v([0-9.]+)\]/</span><span class="br0">&#41;</span><span class="sy0">;</span>
        console.<span class="me1">info</span><span class="br0">&#40;</span>ver<span class="sy0">,</span> <span class="st0">&quot;versus&quot;</span><span class="sy0">,</span> version<span class="br0">&#41;</span><span class="sy0">;</span>
    <span class="br0">&#125;</span>
<span class="br0">&#125;</span><span class="br0">&#41;</span><span class="sy0">;</span></pre></div></div>

]]></content:encoded>
	</item>
	<item>
		<title>By: Martin Kirk</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29699</link>
		<dc:creator>Martin Kirk</dc:creator>
		<pubDate>Fri, 20 Aug 2010 12:08:55 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29699</guid>
		<description>#christoff

you need a serverside-proxy...</description>
		<content:encoded><![CDATA[<p>#christoff</p>
<p>you need a serverside-proxy&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: christoff</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29694</link>
		<dc:creator>christoff</dc:creator>
		<pubDate>Wed, 18 Aug 2010 23:27:19 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29694</guid>
		<description>Perhaps someone can help me, i need to have jQuery render an xml feed in html cross domain from http://clinicaltrials.gov/search?term=%22lyme+disease%22&amp;studyxml=true for instance.

tried the following but it did not work.

    	$(document).ready(function(){
			$.ajax({
				type: &quot;GET&quot;,
				url: &quot;http://clinicaltrials.gov/search?term=%22lyme+disease%22&amp;studyxml=true&quot;,
				dataType: &quot;xml&quot;,
				success: function(xml) {
					$(xml).find(&#039;site&#039;).each(function(){
						var nct_id = $(this).attr(&#039;nct_id&#039;);
						var title = $(this).find(&#039;title&#039;).text();
						var url = $(this).find(&#039;url&#039;).text();
						var condition_summary = $(this).find(&#039;condition_summary&#039;).text();
						var condition_summary = $(this).find(&#039;condition_summary&#039;).text();
						$(&#039;&#039;).html(&#039;&lt;a href=&quot;&#039;+url+&#039;&quot;&gt;&#039;+title+&#039;&lt;/a&gt;&#039;).appendTo(&#039;#page-wrap&#039;);
						$(this).find(&#039;desc&#039;).each(function(){
							var brief = $(this).find(&#039;brief&#039;).text();
							var long = $(this).find(&#039;long&#039;).text();
							$(&#039;&#039;).html(brief).appendTo(&#039;#link_&#039;+id);
							$(&#039;&#039;).html(long).appendTo(&#039;#link_&#039;+id);
						});
					});
				}
			});
		});</description>
		<content:encoded><![CDATA[<p>Perhaps someone can help me, i need to have jQuery render an xml feed in html cross domain from <a href="http://clinicaltrials.gov/search?term=%22lyme+disease%22&#038;studyxml=true">http://clinicaltrials.gov/search?term=%22lyme+disease%22&#038;studyxml=true</a> for instance.</p>
<p>tried the following but it did not work.</p>
<p>    	$(document).ready(function(){<br />
			$.ajax({<br />
				type: &#8220;GET&#8221;,<br />
				url: &#8220;http://clinicaltrials.gov/search?term=%22lyme+disease%22&amp;studyxml=true&#8221;,<br />
				dataType: &#8220;xml&#8221;,<br />
				success: function(xml) {<br />
					$(xml).find(&#8216;site&#8217;).each(function(){<br />
						var nct_id = $(this).attr(&#8216;nct_id&#8217;);<br />
						var title = $(this).find(&#8216;title&#8217;).text();<br />
						var url = $(this).find(&#8216;url&#8217;).text();<br />
						var condition_summary = $(this).find(&#8216;condition_summary&#8217;).text();<br />
						var condition_summary = $(this).find(&#8216;condition_summary&#8217;).text();<br />
						$(&#8221;).html(&#8216;<a href="'+url+'">&#8216;+title+&#8217;</a>&#8216;).appendTo(&#8216;#page-wrap&#8217;);<br />
						$(this).find(&#8216;desc&#8217;).each(function(){<br />
							var brief = $(this).find(&#8216;brief&#8217;).text();<br />
							var long = $(this).find(&#8216;long&#8217;).text();<br />
							$(&#8221;).html(brief).appendTo(&#8216;#link_&#8217;+id);<br />
							$(&#8221;).html(long).appendTo(&#8216;#link_&#8217;+id);<br />
						});<br />
					});<br />
				}<br />
			});<br />
		});</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Nikita Rybak</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29692</link>
		<dc:creator>Nikita Rybak</dc:creator>
		<pubDate>Wed, 18 Aug 2010 17:49:39 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29692</guid>
		<description>Thanks for the hack! 
One thing, since nobody seemed to note it before.

YQL will refuse to return content if webmaster has banned robots from his site (I tested query on yahoo site and response was very clear). In particular, I was trying to get information from google maps business pages (like http://www.google.com/maps/place?cid=17434047103649409317)</description>
		<content:encoded><![CDATA[<p>Thanks for the hack!<br />
One thing, since nobody seemed to note it before.</p>
<p>YQL will refuse to return content if webmaster has banned robots from his site (I tested query on yahoo site and response was very clear). In particular, I was trying to get information from google maps business pages (like <a href="http://www.google.com/maps/place?cid=17434047103649409317">http://www.google.com/maps/place?cid=17434047103649409317</a>)</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: tsu</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29686</link>
		<dc:creator>tsu</dc:creator>
		<pubDate>Tue, 17 Aug 2010 19:44:44 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29686</guid>
		<description>Ermm, and this is so great because...? I&#039;m routinely doing screen-scraping of OPS (other people&#039;s sites) via PHP&#039;s get-contents() function on my own server. This way I get the same code I see in Firebug, which is important to me for extraction. And I don&#039;t have to rely on Yahoo.</description>
		<content:encoded><![CDATA[<p>Ermm, and this is so great because&#8230;? I&#8217;m routinely doing screen-scraping of OPS (other people&#8217;s sites) via PHP&#8217;s get-contents() function on my own server. This way I get the same code I see in Firebug, which is important to me for extraction. And I don&#8217;t have to rely on Yahoo.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: kk</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29662</link>
		<dc:creator>kk</dc:creator>
		<pubDate>Thu, 12 Aug 2010 10:19:31 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29662</guid>
		<description>so what wolud be the best practice to pass xpath parametar , now you use xpath=&quot;*&quot; , but what if i want to filter something on page , for example xpath=&#039;//div[@class=&quot;someContents&quot;]&#039;  ... and/or use limit and offset keywords ?</description>
		<content:encoded><![CDATA[<p>so what wolud be the best practice to pass xpath parametar , now you use xpath=&#8221;*&#8221; , but what if i want to filter something on page , for example xpath=&#8217;//div[@class="someContents"]&#8216;  &#8230; and/or use limit and offset keywords ?</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Swashata</title>
		<link>http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/comment-page-1/#comment-29430</link>
		<dc:creator>Swashata</dc:creator>
		<pubDate>Mon, 28 Jun 2010 07:27:45 +0000</pubDate>
		<guid isPermaLink="false">http://james.padolsey.com/?p=1365#comment-29430</guid>
		<description>Okay looks like modifying this portion of your plugin solves the error call!
&lt;code&gt;
                    if (_success &amp;&amp; data.results[0] != undefined) {
                        // Fake XHR callback.
                        _success.call(this, {
                            responseText: data.results[0]
                                // YQL screws with s
                                // Get rid of them
                                .replace(/]+?\/&gt;&#124;/gi, &#039;&#039;)
                        }, &#039;success&#039;);
                    }
                    else {
                        o.error.call(this, &#039;not received&#039;, &#039;data is null&#039;);
                    }
&lt;/code&gt;
Please let me know if I am correct or not :)</description>
		<content:encoded><![CDATA[<p>Okay looks like modifying this portion of your plugin solves the error call!<br />
<code><br />
                    if (_success &amp;&amp; data.results[0] != undefined) {<br />
                        // Fake XHR callback.<br />
                        _success.call(this, {<br />
                            responseText: data.results[0]<br />
                                // YQL screws with s<br />
                                // Get rid of them<br />
                                .replace(/]+?\/&gt;|/gi, '')<br />
                        }, 'success');<br />
                    }<br />
                    else {<br />
                        o.error.call(this, 'not received', 'data is null');<br />
                    }<br />
</code><br />
Please let me know if I am correct or not <img src='http://james.padolsey.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
]]></content:encoded>
	</item>
</channel>
</rss>

