I'd ideally just like the function to return the shortUrl from the
json results but can't seem to get it anywhere but the callback
function.
...
$.getJSON(http://api.bit.ly/shorten?version=2.0.1longUrl=;
+ url + login= + apiLogin + apiKey= + apiKey, function(data){
I've tried that and still can't seem to get the data into any sort of
usable scope.
On Sep 19, 11:34 am, Bill H dysfunct...@gmail.com wrote:
I've tried that and still can't seem to get the data into any sort of
usable scope.
The problem is that while you may be understanding scope, you are not
understanding asynchronous calls the $.getJSON call doesn't
return anything
In other words, you have to redesign your shortenURL function, like this:
function shortenURL( url, callback ) {
var apiKey = 'APIKEY';
var apiLogin = 'LOGIN';
$.getJSON(
http://api.bit.ly/shorten?version=2.0.1longUrl=;
+ url + login= + apiLogin + apiKey= + apiKey,
4 matches
Mail list logo