WIP: Fix issue #285

This commit is contained in:
Arian van Putten 2015-12-06 12:40:27 +01:00
parent 60f1ddb89e
commit cf475c26c9

View File

@ -34,6 +34,7 @@ generateVanillaJSWith opts req = "\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"