make arg name ambiguous / misleading

This commit is contained in:
James Campos 2012-06-12 11:15:00 -07:00
parent ab94fcfb79
commit 51e6aae640
2 changed files with 9 additions and 9 deletions

View File

@ -324,13 +324,13 @@
return fd; return fd;
}, },
ajax: function(url, callbacks, opts) { ajax: function(url, callbacks, opts) {
var data, headers, key, r, type, upCallbacks, val; var form, headers, key, r, type, upCallbacks, val;
if (opts == null) { if (opts == null) {
opts = {}; opts = {};
} }
type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, data = opts.data; type = opts.type, headers = opts.headers, upCallbacks = opts.upCallbacks, form = opts.form;
r = new XMLHttpRequest(); r = new XMLHttpRequest();
type || (type = data && 'post' || 'get'); type || (type = form && 'post' || 'get');
r.open(type, url, true); r.open(type, url, true);
for (key in headers) { for (key in headers) {
val = headers[key]; val = headers[key];
@ -338,7 +338,7 @@
} }
$.extend(r, callbacks); $.extend(r, callbacks);
$.extend(r.upload, upCallbacks); $.extend(r.upload, upCallbacks);
r.send(data); r.send(form);
return r; return r;
}, },
cache: function(url, cb) { cache: function(url, cb) {
@ -2067,7 +2067,7 @@
} }
}; };
opts = { opts = {
data: data, form: data,
upCallbacks: { upCallbacks: {
onload: function() { onload: function() {
return QR.status({ return QR.status({

View File

@ -274,15 +274,15 @@ $.extend $,
fd.append key, val fd.append key, val
fd fd
ajax: (url, callbacks, opts={}) -> ajax: (url, callbacks, opts={}) ->
{type, headers, upCallbacks, data} = opts {type, headers, upCallbacks, form} = opts
r = new XMLHttpRequest() r = new XMLHttpRequest()
type or= data and 'post' or 'get' type or= form and 'post' or 'get'
r.open type, url, true r.open type, url, true
for key, val of headers for key, val of headers
r.setRequestHeader key, val r.setRequestHeader key, val
$.extend r, callbacks $.extend r, callbacks
$.extend r.upload, upCallbacks $.extend r.upload, upCallbacks
r.send data r.send form
r r
cache: (url, cb) -> cache: (url, cb) ->
if req = $.cache.requests[url] if req = $.cache.requests[url]
@ -1569,7 +1569,7 @@ QR =
target: '_blank' target: '_blank'
textContent: 'Connection error, or you are banned.' textContent: 'Connection error, or you are banned.'
opts = opts =
data: data form: data
upCallbacks: upCallbacks:
onload: -> onload: ->
# Upload done, waiting for response. # Upload done, waiting for response.