1 $.get ($C. apipath+ ' Ucenter/padcharge/findmember ', {id:memberid},function(data) {2 if(data.error) {3 layer.close (memberlayer); 4 padinout (padid,memberid); 5 allpads (); 6 }7 });
1 function Padinout (padid,memberid,callback) {2 $F. postloading ($C. Apipath + ' ucenter/padcharge/ Padinout ', {id:padid,memberid:memberid},function(data) {3 if( Callback) callback ()4 }); 5 };
Executes the callback function when the method finishes executing and the callback function is present. At this point, the function is executed by means of a parameter: Padinout (padid,memberid,allpads) callback function is a common method of JS asynchronous programming. However, there is a bad place to use the callback function, which will cause a callback to hell. So ES new standards are also constantly seeking to solve the callback scheme. This is something, this article is written here.
JavaScript Asynchronous Programming