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