Browse Source

remote validator: Add error handler for failed Ajax request

phuoc 12 years ago
parent
commit
5e6c9ffb46
1 changed files with 2 additions and 3 deletions
  1. 2 3
      src/js/validator/remote.js

+ 2 - 3
src/js/validator/remote.js

@@ -28,10 +28,9 @@
                 data: data
             }).success(function(response) {
                 var isValid =  response.valid === true || response.valid === 'true';
-                if (!isValid) {
-                    validator.showError($field, 'remote');
-                }
                 validator.completeRequest($field, 'remote', isValid);
+            }).error(function(response) {
+                validator.completeRequest($field, 'remote', false);
             });
             validator.startRequest($field, 'remote', xhr);