diff --git a/4chan_x.user.js b/4chan_x.user.js index 7a1ec8f3e..eb6f816e0 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -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({ diff --git a/script.coffee b/script.coffee index eae2559a5..003c05065 100644 --- a/script.coffee +++ b/script.coffee @@ -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.