Click the Enter event (Login)

// increase click the Enter event 
        $ (the Document) .keypress ( function (E) {
             var eCode = e.keyCode e.keyCode: e.which?? E.which: e.charCode;
             // eCode equal to 13 represents a carriage return event 
            IF (eCode == 13 ) {
                 // ajax submit the form, if successful jump page, unsuccessful prompted to enter the account password wrong! 
                $ .ajax ({ 
                    of the type: 'POST' , 
                    dataType: 'json' , 
                    url: basePath + '/ Login / Verify' , 
                    Data: $ ( 'as #loginForm' ) .serialize (), 
                    Success:function (Result) {
                         IF (== 200 is result.status ) {
                             // login is successful then goto 
                            the location.href the basePath + = '/ index' ; 
                        } the else { 
                            Alert ( "user name or account number error ' ); 
                        } 
                    } 
                }); 

            } 
        });

 

Guess you like

Origin www.cnblogs.com/lazyli/p/10973244.html