Tag: TPM obj err str request COM callback function to execute mob
functionKakaajax (obj, callback) {//The function performs the first step passing in two parameters (Obj,callback (a)) so if you want to get the return value of Ajax here No, because the request does not emit Callbcak parameters have been injected;if(Obj.type = = ' POST ') {Obj.data=json.stringify (Obj.data)} common.httpmobilejson ({type:obj.type, Url:obj.url+ '. JSON ', Data:obj.data, success:function(data) {Console.log (data)if(Data.code = = 200) { if(Obj.templatename! = ") { varHTML =template (obj.templatename, data) $ ('. ' +obj.classname). HTML (HTML)}//callback after the request succeedsif(Callback! =NULL) {callback ();//The parameter here is injected at the beginning, but it is not called until it is asynchronous, and it does not fetch the returned data .}}}, error:function(e) {Console.log ("Operation failed"); } });
Ajax callback function callback failed to get return value