Words don't say much, code:
$ (document). Ready (function () {$ (' #defaultForm '). Bootstrapvalidator ({message: ' This value is Not valid ', Feedbackicons: {valid: ' Glyphicon glyphicon-ok ', invalid: ' GL Yphicon Glyphicon-remove ', validating: ' Glyphicon glyphicon-refresh '}, Fields: {entry_code: {validators: {notempty: { Message: ' Verification code cannot be empty '}, Stringlength: { Min:4, Max:4, message: ' CAPTCHA length is 4 bits ', }, Remote: {Url:contro ller+ '/ajax_check_code ', message: ' Captcha is incorrect ', type: ' Get ', DatAtype: ' JSON ', data: {}, Delay:500,},}},} }); })
//Below is the server how to return data instance, see a lot of online is said to return true, false, but not soft with!!!!!!! Gas dead me, write not clear not Chu, still better not write, deceptive!!! Finally found a half-day to find the correct return format! Here's the code:
// If you use TP, other gourd-based painting, as long as the return of JSON data on the line! $code = I (' Entry_code '); if (Check_verify ($code)) { $this->ajaxreturn (array(' valid ' = true, ' message ' = ' Verification Code correct '); Else { $this->ajaxreturn (' valid ' + =false, ' message ' = = ' Verification code is incorrect '); }
Bootstrap Form validator and AJAX verification!!!!