I believe that the syntax for POST is incorrect. I tried it out and it threw errors.
The problem is the ordering of commands (specifcally, calling setrequestheader before calling open).
Sets the value of an HTTP request header. You must call setRequestHeader() after open(), but before send(). If this method is called several times with the same header, the values are merged into one single request header.
No offense, but I really didn't like this. There is actually no difference between Pure JavaScript and Vanilla JavaScript. If you really had to just get some rep, you should have tried going to W3.org.
I like jQuery not for being 'jQuery', but for being short and simple. I create mini projects, so microseconds don't matter at all for me. Yeah if I would ever develop a major project, I would use Server-side code instead of this piece of c-rap!
@afzaal-ahmad-zeeshan "There is actually no difference between Pure JavaScript and Vanilla JavaScript": no, there isn't, they are the same exact thing, and you should know that before going on a rant. No offense!
@afzaal-ahmad-zeeshan lmao you can tell you're a jQuery newbie! Vanilla stands for pure in a sense, not completely but that's the jist. Also I'd like to mention that [].forEach.call is slower than doing
I believe that the syntax for POST is incorrect. I tried it out and it threw errors.
The problem is the ordering of commands (specifcally, calling setrequestheader before calling open).
From https://developer.mozilla.org/en-US/docs/Web/API/XMLHttpRequest
setRequestHeader()
Sets the value of an HTTP request header. You must call setRequestHeader() after open(), but before send(). If this method is called several times with the same header, the values are merged into one single request header.