I have a simple ajax call on one of my views.
var countAnchors;
$.ajax({
    url: countUrl,
    method: "GET",
    data: @Model.InitialTrainingId,
    success: function (result) {
        console.log("result: ",result);
        countAnchors = result;
    },
    error: function (jqXHR) {
        console.log(jqXHR);
        alert("There was a problem");
    }
});
console.log("countAnchors: ",countAnchors);
When I run this, in the console I am seeing:
Why isn't countAnchors being assigned the value in the success function?

 
     
     
    