1

我正在尝试使用 jquery 从http://api.arbetsformedlingen.se/获取 json ,但我无法让它工作!我试了4个小时,现在我放弃了...

我想这可能是一个跨域问题,所以我尝试了 http://james.padolsey.com/javascript/cross-domain-requests-with-jquery/

并且还尝试获取 xml 并使用此 http://www.fyneworks.com/jquery/xml-to-json/

但它没有用..我不想使用 php-proxy 方法来获取 xml 文件。

为什么我不能从 api 获取 json 文件?每次我尝试获取 xml 或 json 文件时,它都会返回一个空页面。

这是一个例子

$(document).ready(function() {
// Checking if jQuery is working
console.log("jQuery running");
var myurl="http://api.arbetsformedlingen.se/platsannons/soklista/kommuner?lanid=10";
console.log(" call back url :"+ myurl);
$.ajax({
    url: myurl,
    type: 'Get',
    cache: false,
    contentType: 'application/json; charset=utf-8',
    dataType: 'json',
    success: function(json) {
     console.log(" reponse :"+ json);
                }  
            });         
});
4

0 回答 0