Comments on: Cross-domain requests with jQuery https://j11y.io/snippets/cross-domain-requests-with-jquery/ Sun, 22 Mar 2015 15:39:22 +0000 hourly 1 https://wordpress.org/?v=5.0.13 By: Sebastian https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1762 Sat, 18 Sep 2010 00:32:19 +0000 https://j11y.io/?p=1365#comment-1762 @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:


$.ajax({
type: 'GET',
url: 'http://www.facebook.com',
success: function(html){
process(html);
},
error: function(){
debug("ajax error");
}
});
{/code}

]]>
By: intsam https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1761 Fri, 17 Sep 2010 19:20:59 +0000 https://j11y.io/?p=1365#comment-1761 Great solution for the cross domain issue. But it didn’t work for some URLs. This URL that I’m trying to load contains most of the dynamic content instead of static. Don’t know if it’s the issue. And the other problem is this didn’t work for me in IE. Worked perfectly in Firefox. Is YQL is browser dependent?

]]>
By: Marius https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1760 Thu, 09 Sep 2010 14:18:34 +0000 https://j11y.io/?p=1365#comment-1760 data.results[0] is undefined, in firebug console.
– any clue what am I doing wrong ?

]]>
By: James https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1759 Wed, 01 Sep 2010 11:34:51 +0000 https://j11y.io/?p=1365#comment-1759 Hey I’m getting a strange error:

Uncaught ReferenceError: jsonp1283340405175 is not defined

Any ideas? Seems like the JSON is not being parsed correctly?

Here’s my ajax request;

$.ajax({
    url: "http://userscripts.org/scripts/show/81657",
    type: "GET",
    success: function(res) {
        var ver = $(res.responseText).find('#summary').text().match(/[v([0-9.]+)]/);
        console.info(ver, "versus", version);
    }
});
]]>
By: Martin Kirk https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1758 Fri, 20 Aug 2010 12:08:55 +0000 https://j11y.io/?p=1365#comment-1758 #christoff

you need a serverside-proxy…

]]>
By: christoff https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1757 Wed, 18 Aug 2010 23:27:19 +0000 https://j11y.io/?p=1365#comment-1757 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&studyxml=true for instance.

tried the following but it did not work.

$(document).ready(function(){
$.ajax({
type: “GET”,
url: “http://clinicaltrials.gov/search?term=%22lyme+disease%22&studyxml=true”,
dataType: “xml”,
success: function(xml) {
$(xml).find(‘site’).each(function(){
var nct_id = $(this).attr(‘nct_id’);
var title = $(this).find(‘title’).text();
var url = $(this).find(‘url’).text();
var condition_summary = $(this).find(‘condition_summary’).text();
var condition_summary = $(this).find(‘condition_summary’).text();
$(”).html(‘‘+title+’‘).appendTo(‘#page-wrap’);
$(this).find(‘desc’).each(function(){
var brief = $(this).find(‘brief’).text();
var long = $(this).find(‘long’).text();
$(”).html(brief).appendTo(‘#link_’+id);
$(”).html(long).appendTo(‘#link_’+id);
});
});
}
});
});

]]>
By: Nikita Rybak https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1756 Wed, 18 Aug 2010 17:49:39 +0000 https://j11y.io/?p=1365#comment-1756 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)

]]>
By: tsu https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1755 Tue, 17 Aug 2010 19:44:44 +0000 https://j11y.io/?p=1365#comment-1755 Ermm, and this is so great because…? I’m routinely doing screen-scraping of OPS (other people’s sites) via PHP’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’t have to rely on Yahoo.

]]>
By: kk https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1754 Thu, 12 Aug 2010 10:19:31 +0000 https://j11y.io/?p=1365#comment-1754 so what wolud be the best practice to pass xpath parametar , now you use xpath=”*” , but what if i want to filter something on page , for example xpath=’//div[@class=”someContents”]’ … and/or use limit and offset keywords ?

]]>
By: Swashata https://j11y.io/snippets/cross-domain-requests-with-jquery/#comment-1753 Mon, 28 Jun 2010 07:27:45 +0000 https://j11y.io/?p=1365#comment-1753 Okay looks like modifying this portion of your plugin solves the error call!

if (_success && data.results[0] != undefined) {
// Fake XHR callback.
_success.call(this, {
responseText: data.results[0]
// YQL screws with s
// Get rid of them
.replace(/]+?/>|/gi, '')
}, 'success');
}
else {
o.error.call(this, 'not received', 'data is null');
}

Please let me know if I am correct or not 🙂

]]>