JSONP错误,Uncaught SyntaxError

时间:2017-11-21 05:31:27

标签: javascript jquery json jsonp

我收到了SyntaxError,但与其他链接一起工作正常。任何想法???

function loadData() {
    var wikiUrl = 'http://www.masslottery.com/data/json/search/dailygames/history/15/201711.json';
    //http://www.masslottery.com/data/json/search/dailygames/history/15/201711.json?callback=jQuery1111019608043600812386_1511241988068&_=1511241988069
    $.ajax({
        url: wikiUrl,
        dataType: "jsonp",
    }).done(function (response) {
        for (var i = 0; i < response; i++) {
            console.log(response);
        }
    }).fail(function () {
        //  console.log(response);
    });
    return false;
};

$('#form-container').submit(loadData);

1 个答案:

答案 0 :(得分:0)

$.ajax({
   url:"your link"
   method: "get" or "post"
   dataType: "json" or "jsonp"
}).done(function(res) {
   console.log(res);
}).fail(function(error) {
   console.log(error);
});
你错过了方法。