0

当我调用查询以获取最近的 Dominoes 插座时,我正在尝试检索数据。

这是我的电话代码:

var echo = function(dataPass) {
    $.ajax({
        type: "POST",
        url: "/echo/json/",
        data: dataPass,
        cache: false,
        success: function(json) {
            console.log("It's a success, folks!");
        }
    });
};

$('.list').live('click', function() {
    $.get("http://www.dominos.co.in/outlet?city=AMRITSAR&restaurent=DP66001", function(data) {
        var json = {
            json: JSON.stringify(data),
            delay: 1
        };
        echo(json);
    });
});

通常,如果呼叫成功,我将获得最近的多米诺骨牌商店的谷歌地图表示。为此,我正在使用多米诺骨牌定位器:http ://www.dominos.co.in/outlet?city=AMRITSAR&restaurent=DP66001

但是,当我在小提琴中运行它时,出现以下错误:

XMLHttpRequest cannot load http://www.dominos.co.in/outlet?city=AMRITSAR&restaurent=DP66001. Origin http://fiddle.jshell.net is not allowed by Access-Control-Allow-Origin.

小提琴:http : //jsfiddle.net/YUWB2/154/

我哪里错了?

编辑: 我知道这是因为Same Origin Policy,我想知道是否有其他方法可以做到这一点?

4

1 回答 1

0

You might be able to use JSONP. If not, there is no JavaScript solution, since the server must allow cross origin requests. You could build a proxy server that does, though.

于 2013-10-01T13:23:20.073 回答