Ajax Invocation Instances

Source: Internet
Author: User

Examples of Haier subscription buttons:

    $ (". Dingyue"). Click (function () {if () {Istrsidssdssotoken () {//cookie) if sign in if (null = = Proid | |            "Undefined" = = proid) {return; } if (null = = Urlxmlpath | |            "Undefined" = = Urlxmlpath) {return;            } var productcate = "";            if (Urlxmlpath.indexof ("/cooling/") >-1) {productcate = "refrigerator";            } else if (Urlxmlpath.indexof ("/laundry/") >-1) {productcate = "washing machine";            } else if (Urlxmlpath.indexof ("/air_conditioners/") >-1) {productcate = "air conditioning";            } else if (Urlxmlpath.indexof ("/televisions/") >-1) {productcate = "color TV";            } else if (Urlxmlpath.indexof ("/kitchen_appliances/") >-1) {productcate = "kitchen appliance";            } else if (Urlxmlpath.indexof ("/kitchen/") >-1) {productcate = "whole Kitchen"; } else if (Urlxmlpath.indexof ("/water_heater/") > -1) {productcate = "water heater";            } else if (Urlxmlpath.indexof ("/small_applications/") >-1) {productcate = "home appliance";            } else if (Urlxmlpath.indexof ("/computers/") >-1) {productcate = "computer";            } else if (Urlxmlpath.indexof ("/lsdn/") >-1) {productcate = "history computer";            } else if (Urlxmlpath.indexof ("/digital/") >-1) {productcate = "mobile phone digital";            } var countryname = "cn"; Jquery.ajax ({type: "Post", DataType: "json", url: "/haierframework/haier/myc                    Ollection/addproductcollectionasync.do ", data: {' productId ': proid, ' Productxmlpath ': Urlxmlpath, ' countryname ': countryname, ' productcategory ': Product Cate}, Success:function (Returnresult) {if (returnresult.issuccESS) {if (Returnresult.stutas = = 2) {$ (". Js_collect_head"). HTML ("");                            $ (". Js_collect_head"). HTML ("You have already collected this product");                            var logintype = Logintype ();                                if (Logintype = = "Haiercounts") {$ ("#js_collect_threelogin"). Hide ();                                var userinfo = GetUserInfo ();                                        if (userinfo! = "") {if (Userinfo.indexof (",")! =-1) {                                        var Infoarray = Userinfo.split (",");                                        var emailtemp = infoarray[0];                                        var teltemp = infoarray[1];                                        var Emailarray = emailtemp.split ("=");                                        email = emailarray[1];                  var Telarray = teltemp.split ("=");                      tel = telarray[1];                                            } else {if (Userinfo.indexof ("email")! =-1) {                                            var Emailarray = userinfo.split ("=");                                        email = emailarray[1];                                             } else if (Userinfo.indexof ("tel")! =-1) {var telarray = userinfo.split ("=");                                        tel = telarray[1]; }}} $ ("#js_message_mail                                2 "). Val (email);                            $ ("#js_message_tel2"). Val (tel);                            } else {$ ("#js_collect_haierlogin"). Hide ();                        } $ (". Js_btn_collect"). Click ();      } else {                      var logintype = Logintype ();                                if (Logintype = = "Haiercounts") {$ ("#js_collect_threelogin"). Hide ();                                var userinfo = GetUserInfo ();                                        if (userinfo! = "") {if (Userinfo.indexof (",")! =-1) {                                        var Infoarray = Userinfo.split (",");                                        var emailtemp = infoarray[0];                                        var teltemp = infoarray[1];                                        var Emailarray = emailtemp.split ("=");                                        email = emailarray[1];                                        var Telarray = teltemp.split ("=");                                    tel = telarray[1];                                } else {if (Userinfo.indexof ("email")! =-1) {            var Emailarray = userinfo.split ("=");                                        email = emailarray[1];                                             } else if (Userinfo.indexof ("tel")! =-1) {var telarray = userinfo.split ("=");                                        tel = telarray[1]; }}} $ ("#js_message_mail                                2 "). Val (email);                            $ ("#js_message_tel2"). Val (tel);                            } else {$ ("#js_collect_haierlogin"). Hide ();                        } $ (". Js_btn_collect"). Click ();                    }//Monitoring code collection_success ();                    } else {gotologin (); }}, Error:functiOn () {}});        } else {gotologin (); }    })

The simplest example:

$.ajax ({        URL: "/api/workflow/task!cancelandagreeordisagreestep.do",        dataType: ' json ',        type: ' Post ',        data: {            task_id:task_id        },        success:function success (data) {            //executed after success                     },        error: Function error () {            //alert (' Get information failed ');        }    });

Just record it ~

Ajax Invocation Instances

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.