| rss2email.ru |
ЛерКом - из-под мышки художника | Silenseo.ru - Блог для стремящихся вверх |
The latest news about Pipes http://blog.pipes.yahoo.net рекомендовать друзьям >> |
- Pipes now has Cross-Origin Resource Sharing (CORS) support.
If you use a modern browser (FF3.5+,Chrome 3+,Safari 4+,IE8+) you can now access Pipes data using AJAX from a different domain.
You can use YUI3 IO (use: 'native') to make the request for you or you can hand craft your own.
Some sample code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <title>Pipes CORS test</title> <script src="https://github.com/douglascrockford/JSON-js/raw/master/json2.js"> </script> </head> <body> <div id="output"> </div> <script> function createCORSRequest(method, url){ var xhr = new XMLHttpRequest(); if ("withCredentials" in xhr) { xhr.open(method, url, true); } else if (typeof XDomainRequest != "undefined") { xhr = new XDomainRequest(); xhr.open(method, url); } else { xhr = null; } return xhr; } var request = createCORSRequest("get", "http://pipes.yahoo.com/pipes/pipe.run?_id=ZKJobpaj3BGZOew9G8evXg&_render=json&ticker=YHOO,GOOG"); if (request) { request.onload = function(){ var r = JSON.parse(request.responseText); var holder = ""; for (var x = 0, rl = r.value.items.length; x < rl; x++) { holder += r.value.items[x].title + "<br>"; holder += r.value.items[x].description; holder += "<hr>"; } document.getElementById("output").innerHTML = holder; }; request.send(); } </script> </body> </html>Переслать
| rss2email.ru | отписаться: http://www.rss2email.ru/unsubscribe.asp?c=27836&u=154831&r=824809263 управление подпиской: http://www.rss2email.ru/manage.asp |