how variable is visible in javascript function call back
function getAjaxData(){
var **$node** = $('#note_container');
if ($node.data('ajax-cache').length == 0) {
$.ajax({
// do stuff.
success: function(data){
// Add dialog content How this node is visible in two scopes?
**$node**.html(data).data('ajax-cache',data).dialog();
}
});
} else {
$node.html( $node.data('ajax-cache') ).dialog();
}
}
getAjaxData();
Instead of making second request values are stored in node .But how node can be visible in the second first order function
It is two nested scopes deep inside of the function.
Is it the reason angular was created and such frameworks?