Ajax callback function callback failed to get return value

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.