TIMEX
TIMEX

Reputation: 271614

Can someone see why this JQuery JSONP is not working?

$.getJSON("https://api.foursquare.com/v2/venues/search?&callback=fs_venue_search", {
        ll: "40.7,-74",       
        client_id: "Y3AWKSPSCWEGGSQBELQVDWRG4EX4PRWJ4HMWSKGQSVRPPXI1",
        client_secret: "abc",

        format: "json"
    }, function(data){
        alert(data);
    }); 

Nothing happens when I run this script.

Upvotes: 0

Views: 332

Answers (3)

Oleg
Oleg

Reputation: 221997

This one

$.getJSON("https://api.foursquare.com/v2/venues/search?&callback=?", {
    ll: "40.7,-74",
    client_id: "Y3AWKSPSCWEGGSQBELQVDWRG4EX4PRWJ4HMWSKGQSVRPPXI1",
    client_secret: "5FBPDNM2TQDMFSBQUKZSWR3ZGJWDTXYA2IHJLLMMO0J2LVC",

    format: "json"
}, function(data){
    alert(data.meta.code);
});

work and display "200".

Upvotes: 1

TIMEX
TIMEX

Reputation: 271614

Solved.

$.getJSON("https://api.foursquare.com/v2/venues/search", {
        ll: "40.7,-74",       
        client_id: "Y3AWKSPSCWEGGSQBELQVDWRG4EX4PRWJ4HMWSKGQSVRPPXI1",
        client_secret: "abc",
        format: "jsonp"
    }, function(data){
        alert(data);
    }); 

Upvotes: 0

lonesomeday
lonesomeday

Reputation: 237817

You're providing callback= in the original URL and in the data object. One of them appears to be misspelt. Set only one, and see if your code then works.

Upvotes: 0

Related Questions