weixin_33712987 2017-02-01 22:21 采纳率: 0%
浏览 28

JSONP和Framework7

I'm trying to get images from Instagram public api via ajax and JSONP:

var target = https://www.instagram.com/p/BP3Wu_EDXsjdT5Llz13jFv2UeS0Vw0OTxrztmo0/?__a=1?callback=?';    

$$.ajax({                 
                  type: "GET",
                  dataType: 'json',
                  crossDomain: true,
                  url: target,

                  success: function(data){
                    console.log(data);
                  },                  

                error: function(xhr,status){
                    console.log("Error"+status);
                }
            });

I'm getting: Uncaught SyntaxError: Unexpected token <.

What's wrong? Thanks

  • 写回答

2条回答 默认 最新

  • weixin_33711641 2017-02-01 22:40
    关注

    A few mistakes...

    var target = 'https://www.instagram.com/p/BP3Wu_EDXsjdT5Llz13jFv2UeS0Vw0OTxrztmo0/?__a=1&callback=';  
    

    Changes: Missing ' at the beginning and changed second ? with &

    Should work fine

    评论

报告相同问题?