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

See how the beta release of Kubernetes on DC/OS 1.10 delivers the most robust platform for building & operating data-intensive, containerized apps. Register now for tech preview.

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!

New Mesosphere DC/OS 1.10: Production-proven reliability, security & scalability for fast-data, modern apps. Register now for a live demo.

Topics:

Opinions expressed by DZone contributors are their own.

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

{{ parent.tldr }}

{{ parent.urlSource.name }}