jquery - How to request cross-domain for xml on javascript -


i want show yahoo news feeds in website, need read yahoo rss.

how request it, javascript? "access-control-allow-origin" let go?

xml won't run cross-site that. convert json using yahoo pipes.

using pipe http://pipes.yahoo.com/pipes/pipe.info?_id=djeg41ac3bg8iai2e5pzna , configuring url:http://news.yahoo.com/rss/ , path:channel.item

you can make json output grabbing "get json" link gives url: http://pipes.yahoo.com/pipes/pipe.run?_id=djeg41ac3bg8iai2e5pzna&_render=json&path=channel.item&url=http%3a%2f%2fnews.yahoo.com%2frss%2f

and here's jsfiddle using pipe http://jsfiddle.net/5km4x/

if don't want rely on pipes, write local server side script nothing proxy remote url , expose it's output. using php, have file called

getfeed.php

<?php header('content-type: application/xml'); echo file_get_contents("http://news.yahoo.com/rss"); 

and access (using jquery here)

 $.get('getfeed.php', function(xml){  .... 

Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -