JS callback function application simple example

  • 2020-03-30 03:57:48
  • OfStack

JS callback function is very simple, see the code:

In a. s


var myback = null; 
function load(obj){ 
myback = obj; 
} 

function save(){ 
//Background request
$.ajax.post...... 
//Call the callback function
myback(); 
} 

The call is made in b.js


//Just pass the function to be called back as an argument!

load(function(){ 
this.hide(); 
})

Related articles: