/// <Summary> set the available button </Summary> function funsetbuttontrue (name) {document. getelementbyid (name ). disabled = false; // true: false: available document. getelementbyid (name ). value = "save";} // <summary> set the button to unavailable </Summary> function funsetbuttonfalse (name) {document. getelementbyid (name ). disabled = true; // true: false: available document. getelementbyid (name ). value = "submitting... ";}/// <summary> Get parameter </Summary> function request Name (strname) {var strhref = specified parameter Doc ument. Location. href; var intpos = strhref. indexof ("? "); Var strright = strhref. substr (intpos + 1); var arrtmp = strright. split ("&"); For (VAR I = 0; I <arrtmp. length; I ++) {var arrtemp = arrtmp [I]. split ("="); If (arrtemp [0]. touppercase () = strname. touppercase () return arrtemp [1];} return "";}
Usage
Function funsubmit () {var identificationimage = $ ("# mainbox IMG "). ATTR ("src"); var driverlicenseimage = $ ("# mainbox1 IMG "). ATTR ("src"); var creditcardimage = $ ("# mainbox2 IMG "). ATTR ("src"); var hidvalue = $ ("input [name = '_ requestverificationtoken']"). val (); funsetbuttonfalse ("btnsubmit"); // apply $. ajax ({URL: "/verification/Index", datatype: "JSON", type: "Post", data: {identificationimage: IDENT Ificationimage, driverlicenseimage: driverlicenseimage, creditcardimage: creditcardimage, _ requestverificationtoken: hidvalue}, success: function (data) {If (data. status = "0") {alert (data. errmsg); funsetbuttontrue ("btnsubmit"); // return is applied here;} else {alert (data. errmsg); funsetbuttontrue ("btnsubmit"); // use window here. location. href = Window. location. href ;}, error: function () {alert ("network error, please try again! ");}});}
Effect
Modify button Value