I have this script:
var d;
$(".circle").click(function() {
    var id = $(this).attr('id');
    var MyDiv1 = document.getElementById(id);
    var name = MyDiv1.innerHTML;
    $.get("url", function(data){
    d=data;
    });
    d=d.split(",");
    var arrayLength = d.length;
    for (var i = 0; i < arrayLength; i++) {
        if(i==id)
         custom_alert(d[i], name);
    }
});
I want to call
d = d.split(",");
Only after I'm sure d isn't undefined.
How do I execute that after the $.get functions finishes and d is assigned to the data?
 
     
     
     
    