Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

Cross Domain Calls in jQuery

DZone's Guide to

Cross Domain Calls in jQuery

· Big Data Zone ·
Free Resource

Hortonworks Sandbox for HDP and HDF is your chance to get started on learning, developing, testing and trying out new features. Each download comes preconfigured with interactive tutorials, sample data and developments from the Apache community.

Cross Domain Call in jQuery 

We needed to be able to call a web site in client side from another domain address. We fixed this with combination of a custom jQuery plugin and YQL (Yahoo Query Language). You can find more information in here.

Client code will be like below:

$('#container').load('http://google.com'); // SERIOUSLY!
  
$.ajax({
    url: 'http://news.bbc.co.uk',
    type: 'GET',
    success: function(res) {
        var headline = $(res.responseText).find('a.tsh').text();
        alert(headline);
    }
});
  
// Works with $.get too!

Hortonworks Community Connection (HCC) is an online collaboration destination for developers, DevOps, customers and partners to get answers to questions, collaborate on technical articles and share code examples from GitHub.  Join the discussion.

Topics:

Opinions expressed by DZone contributors are their own.

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}