浏览代码

remote validator: Add error handler for failed Ajax request

phuoc 12 年之前
父节点
当前提交
5e6c9ffb46
共有 1 个文件被更改,包括 2 次插入3 次删除
  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);