xuijs / xui

A tiny javascript framework for mobile web apps.
http://xuijs.com
788 stars 106 forks source link

xhr should allow Http code 201 as successful #63

Closed ghost closed 12 years ago

ghost commented 12 years ago
diff --git a/iOS/www/js/lib/xui-2.2.0.js b/iOS/www/js/lib/xui-2.2.0.js
index 1a0e50d..aa9bddb 100644
--- a/iOS/www/js/lib/xui-2.2.0.js
+++ b/iOS/www/js/lib/xui-2.2.0.js
@@ -1358,8 +1358,11 @@ xui.extend({
         function hdl(){ 
             if(req.readyState==4) {
                 delete(that.xmlHttpRequest);
-                if(req.status===0 || req.status==200) req.handleResp(); 
-                if((/^[45]/).test(req.status)) req.handleError(req.status, req.statusText);
+                if(req.status===0 || (/^[2]/).test(req.status)) {
+                    req.handleResp(); 
+                } else if((/^[45]/).test(req.status)) {
+                    req.handleError(req.status, req.statusText);
+                }
             }
         }
         if(async) {