How to add a callback to a function in javascript

后端 未结 4 695
既然无缘
既然无缘 2020-12-14 17:52

I have two javascript functions

function one () {
   do something long... like writing jpgfile on disk
}

function two () {
   do something fast... like show         


        
4条回答
  •  感情败类
    2020-12-14 17:52

    Try this,

    $.when($.ajax(fuction1())).then(function () {
    
    fuction2;
    
    });
    

    Here fuction1 is your first function to call, and fuction2 is your second function.

提交回复
热议问题