I have the following code, and for some odd reason, the order in which the events are happening is not making sense to me. Is there anyway in which I can make it so that it goes in the order?
var vm_good = false;
console.log("Before", vm_good);
$.post("./ajax/call_price", {id: product_id}, function(data){
$.each(data, function(key, value){
$(".unit-price span").html(value);
});
vm_good = true;
console.log("Inside", vm_good);
enableNext();
}, 'json');
console.log("After", vm_good);
And the results on the console window is:
>Before false
>After false
>Inside true
>window.vm_good // I called it manually after the page loaded
>>true