James
James

Reputation: 1475

jquery get api using jquery get

I'm doing a simple test using the wakoopa (software tracking) api. Typing the following url in a browser relusts in unformated json

http://social.wakoopa.com/makingthings/software.json?

According to wakoopa "By default JSON-responses are wrapped in a callback function named wakoopaApi" I'm trying to so a simple jquery test: with no reults

jQuery(document).ready(function($) {
  $.get("http://social.wakoopa.com/makingthings/software.json?sort=active_seconds&period=month", function wakoopaApi(data){
    alert("Data Loaded: " + data.software);
  });
});

Any Ideas?

Upvotes: 2

Views: 299

Answers (1)

Nicola Peluchetti
Nicola Peluchetti

Reputation: 76880

I think you should do

jQuery(document).ready(function($) {
    $.getJSON("http://social.wakoopa.com/makingthings/software.json?sort=active_seconds&period=month&callback=?", function(data){
       $.each(data, function(){
           alert(this.software.name);    
        });
     });
});

in this way you add a parameter that specifies the callback (callback=?) and everything works

Look here http://jsfiddle.net/ZSzrm/

Upvotes: 2

Related Questions