diff options
Diffstat (limited to 'share/www/script/couch.js')
-rw-r--r-- | share/www/script/couch.js | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/share/www/script/couch.js b/share/www/script/couch.js index 4586cca8..8f3d96ad 100644 --- a/share/www/script/couch.js +++ b/share/www/script/couch.js @@ -319,16 +319,19 @@ CouchDB.replicate = function(source, target, rep_options) { return JSON.parse(CouchDB.last_req.responseText); } -CouchDB.request = function(method, uri, options) { - options = options || {}; - var req = null; +CouchDB.newXhr = function() { if (typeof(XMLHttpRequest) != "undefined") { - req = new XMLHttpRequest(); + return new XMLHttpRequest(); } else if (typeof(ActiveXObject) != "undefined") { - req = new ActiveXObject("Microsoft.XMLHTTP"); + return new ActiveXObject("Microsoft.XMLHTTP"); } else { throw new Error("No XMLHTTPRequest support detected"); } +} + +CouchDB.request = function(method, uri, options) { + options = options || {}; + var req = CouchDB.newXhr(); req.open(method, uri, false); if (options.headers) { var headers = options.headers; |