diff --git a/4chan_x.user.js b/4chan_x.user.js index 90d2050e5..5bccf0d6a 100644 --- a/4chan_x.user.js +++ b/4chan_x.user.js @@ -333,12 +333,12 @@ type || (type = 'get'); event || (event = 'onload'); r = new XMLHttpRequest(); + r.open(type, url, true); for (key in headers) { val = headers[key]; r.setRequestHeader(key, val); } r[event] = cb; - r.open(type, url, true); r.send(); return r; }, diff --git a/script.coffee b/script.coffee index a497dbe81..0c3e4e913 100644 --- a/script.coffee +++ b/script.coffee @@ -236,10 +236,10 @@ $.extend $, type or= 'get' event or= 'onload' r = new XMLHttpRequest() + r.open type, url, true for key, val of headers r.setRequestHeader key, val r[event] = cb - r.open type, url, true r.send() r cache: (url, cb) ->