smarter ajax type checking
This commit is contained in:
parent
d6aa2ef83e
commit
f7a9fb526e
@ -317,7 +317,11 @@
|
||||
}
|
||||
type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data;
|
||||
r = new XMLHttpRequest();
|
||||
r.open(type || 'get', url, true);
|
||||
if (data) {
|
||||
type || (type = 'post');
|
||||
}
|
||||
type || (type = 'get');
|
||||
r.open(type, url, true);
|
||||
for (key in headers) {
|
||||
val = headers[key];
|
||||
r.setRequestHeader(key, val);
|
||||
@ -2064,7 +2068,6 @@
|
||||
};
|
||||
opts = {
|
||||
data: data,
|
||||
type: 'POST',
|
||||
upCallbacks: {
|
||||
onload: function() {
|
||||
return QR.status({
|
||||
|
||||
@ -268,7 +268,9 @@ $.extend $,
|
||||
ajax: (url, callbacks, opts={}) ->
|
||||
{type, headers, upCallbacks, data} = opts
|
||||
r = new XMLHttpRequest()
|
||||
r.open type or 'get', url, true
|
||||
type or= 'post' if data
|
||||
type or= 'get'
|
||||
r.open type, url, true
|
||||
for key, val of headers
|
||||
r.setRequestHeader key, val
|
||||
$.extend r, callbacks
|
||||
@ -1563,7 +1565,6 @@ QR =
|
||||
textContent: 'Connection error, or you are banned.'
|
||||
opts =
|
||||
data: data
|
||||
type: 'POST'
|
||||
upCallbacks:
|
||||
onload: ->
|
||||
# Upload done, waiting for response.
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user