arduino esp8266webserver 返回错误 json

arduino esp8266webserver error in returning json

在我的arduino sketch中我有这个代码:

void handleRoot() {
  server.send ( 200, "application/json", "{success:true,deviceID:'bla'}" );
}

所以我的arduino从我的wifi AP(192.168.0.100)获取IP并且在我的客户端的js代码中我有这个:

$.ajax({
  type: "POST",
  url: "http://192.168.0.100/",
  success: function(responseData) {
        alert(responseData);
},
});

但是 alert(responseData) 甚至都没有启动... 我检查了浏览器控制台,发现我得到了这个:

回应headers:

HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: 29
Connection: close
Access-Control-Allow-Origin: *

在响应内容中我有这个:

{success:true,deviceID:'bla'}

为什么此内容没有出现在警报中?

使用以下示例:

server.send(200, "text/plain", "{\"success\":1,\"deviceID\":\"bla\"}");

并在Ajax端解析:

JSON.parse(responseData);