嵌套函数中的回调

i have a function which calls the another function and so on.

function A(args,callback){    
// make ajax request
//  on response 
    B()    
}

function B(args){

// make ajax request
//  on response 
    C()
}

function C(args){

  // make ajax request
  //  on response 
    D()
}

I am making such ten ajax calls. Two questions...

  1. can anyone explain me what is callback-hell? Is this a callback Hell?
  2. If i call callback() inside function D, will it get called. I am not passing callback as argument to my other functions.

Inside D() there is no way to call callback because it is not defined there. What I mean by this is as long as you don't pass arguments down the callbacks then you are not having your callback variable inside D(). Callback hell is a situation where callbacks call each-other meaning A() calls B() and B() calls A().

  1. I don't know what you're calling callback hell but it's one hell of a spaghetti code.

What is "callback hell"?
Asynchronous javascript, or javascript that uses callbacks, is hard to get right intuitively.

Source

2.No, callback is not defined inside D so you will get an Error.

We can pass function reference as a parameter in JavaScript and use this reference to call related function whenever/ wherever we want.

for more info see this link http://recurial.com/programming/understanding-callback-functions-in-javascript/