I am getting some data from a server using $.getJSON as follows ..
$.getJSON( 'http://192.168.2.24/index.php/hooks/' + a[i].BSSID, function() {
  console.log( "success" );
})
  .done(function(data) {
    url_redirect = data.SSID;
    console.log("DATA:" + url_redirect)
  }) ...
Before all of this I declare the variable url_redirect but this is not set with url_redirect = data.SSID even though the console.log proves it is. If I set var url_redirect = ""; right at the beginning of my script does this not make it global?
