I'm developing a page that pulls images from Flickr and Panoramio via jQuery's AJAX support.
(我正在开发一个页面,该页面通过jQuery的AJAX支持从Flickr和Panoramio中提取图像。)
The Flickr side is working fine, but when I try to $.get(url, callback)
from Panoramio, I see an error in Chrome's console:
(Flickr方面运行良好,但是当我尝试从Panoramio进行$.get(url, callback)
时,我在Chrome的控制台中看到一个错误:)
XMLHttpRequest cannot load http://www.panoramio.com/wapi/data/get_photos?v=1&key=dummykey&tag=test&offset=0&length=20&callback=processImages&minx=-30&miny=0&maxx=0&maxy=150 .
(XMLHttpRequest无法加载http://www.panoramio.com/wapi/data/get_photos?v=1&key=dummykey&tag=test&offset=0&length=20&callback=processImages&minx=-30&miny=0&maxx=0&maxy=150 。)
Origin null is not allowed by Access-Control-Allow-Origin. (Access-Control-Allow-Origin不允许使用Origin null。)
If I query that URL from a browser directly it works fine.
(如果我直接从浏览器查询该URL,它将正常工作。)
What is going on, and can I get around this? (这是怎么回事,我可以解决这个问题吗?)
Am I composing my query incorrectly, or is this something that Panoramio does to hinder what I'm trying to do? (我是在错误地编写查询,还是Panoramio这样做妨碍了我的工作?)
Google didn't turn up any useful matches on the error message .
(Google并未在错误消息中显示任何有用的匹配项。)
EDIT
(编辑)
Here's some sample code that shows the problem:
(这是一些显示问题的示例代码:)
$().ready(function () {
var url = 'http://www.panoramio.com/wapi/data/get_photos?v=1&key=dummykey&tag=test&offset=0&length=20&callback=processImages&minx=-30&miny=0&maxx=0&maxy=150';
$.get(url, function (jsonp) {
var processImages = function (data) {
alert('ok');
};
eval(jsonp);
});
});
You can run the example online .
(您可以在线运行示例 。)
EDIT 2
(编辑2)
Thanks to Darin for his help with this.
(感谢达林在这方面的帮助。)
THE ABOVE CODE IS WRONG. (上面的代码错误。)
Use this instead: (使用此代替:)
$().ready(function () {
var url = 'http://www.panoramio.com/wapi/data/get_photos?v=1&key=dummykey&tag=test&offset=0&length=20&minx=-30&miny=0&maxx=0&maxy=150&callback=?';
$.get(url, function (data) {
// can use 'data' in here...
});
});
ask by Drew Noakes translate from so 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…