mayhem
This commit is contained in:
parent
e770265266
commit
1e2aa40e22
@ -330,10 +330,7 @@
|
||||
}
|
||||
type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data;
|
||||
r = new XMLHttpRequest();
|
||||
if (data) {
|
||||
type || (type = 'post');
|
||||
}
|
||||
type || (type = 'get');
|
||||
type || (type = data && 'post' || 'get');
|
||||
r.open(type, url, true);
|
||||
for (key in headers) {
|
||||
val = headers[key];
|
||||
@ -341,11 +338,7 @@
|
||||
}
|
||||
$.extend(r, callbacks);
|
||||
$.extend(r.upload, upCallbacks);
|
||||
if (typeof data === 'string') {
|
||||
r.sendAsBinary(data);
|
||||
} else {
|
||||
r.send(data);
|
||||
}
|
||||
r.send(data);
|
||||
return r;
|
||||
},
|
||||
cache: function(url, cb) {
|
||||
|
||||
@ -276,14 +276,13 @@ $.extend $,
|
||||
ajax: (url, callbacks, opts={}) ->
|
||||
{type, headers, upCallbacks, data} = opts
|
||||
r = new XMLHttpRequest()
|
||||
type or= 'post' if data
|
||||
type or= 'get'
|
||||
type or= data and 'post' or 'get'
|
||||
r.open type, url, true
|
||||
for key, val of headers
|
||||
r.setRequestHeader key, val
|
||||
$.extend r, callbacks
|
||||
$.extend r.upload, upCallbacks
|
||||
if typeof data is 'string' then r.sendAsBinary data else r.send data
|
||||
r.send data
|
||||
r
|
||||
cache: (url, cb) ->
|
||||
if req = $.cache.requests[url]
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user