I use this helper function to receive JSON results for my requests:
function getData(url) { $.get(url, function(data) { response =
try this
function getData(url) { var data; $.ajax({ async: false, //thats the trick url: 'http://www.example.com', dataType: 'json', success: function(response){ data = response; } }); return data; }