Cross-domain requests with jQuery

เทคนิคนี้เค้านำเอา YQL (Yahoo! Query Language) เข้ามาช่วยด้วยครับ

ซึ่งเจ้า YQL จะช่วยให้เราสามารถเรียก (request) ข้ามโดเมนได้ครับ

แถมคนที่เค้าเขียนอธิบายเกี่ยวกับเรื่องนี้ (การใช้ YQL ร่วมกับ jQuery)

เค้าก็ยังใจดีเขียนเป็น plugin ของ jQuery ไว้ให้ใช้เลยด้วยครับ

ตัวอย่างการใช้งาน

$.ajax({
    url: 'http://news.bbc.co.uk',
    type: 'GET',
    success: function(res) {
        var headline = $(res.responseText).find('a.tsh').text();
        alert(headline);
    }
});

Leave a Comment


NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>