Jquery getJSON Uncaught SyntaxError: Unexpected token : error

后端 未结 4 1382
面向向阳花
面向向阳花 2021-01-03 16:27

I am trying to connect to the RubyGems API, but when I try to get the JSON I get an stange error.

Uncaught SyntaxError: Unexpected token :

4条回答
  •  清酒与你
    2021-01-03 17:10

    Given that you're passing in a data-handler function to getJSON(), are you sure you want the JSONP callback parameter? Try removing ?jsoncallback=? from the URL:

    .getJSON("http://rubygems.org/api/v1/gems/rails.json", function(data) {
        ...function stuff....
    });
    

提交回复
热议问题