Merge pull request #287 from arianvp/285

WIP: Fix issue #285
This commit is contained in:
Julian Arni 2015-12-10 23:44:25 +01:00
commit bf8959d2d7

View file

@ -33,6 +33,8 @@ generateVanillaJSWith opts req = "\n" <>
<> " var xhr = new XMLHttpRequest();\n"
<> " xhr.open('" <> method <> "', " <> url <> ", true);\n"
<> reqheaders
<> " xhr.setRequestHeader(\"Accept\",\"application/json\");\n"
<> (if isJust (req ^. reqBody) then " xhr.setRequestHeader(\"Content-Type\",\"application/json\");\n" else "")
<> " xhr.onreadystatechange = function (e) {\n"
<> " if (xhr.readyState == 4) {\n"
<> " var value = JSON.parse(xhr.responseText);\n"