0
阿贾克斯我有以下的猫鼬服务器(server,而不是JavaScript库):JSON与猫鼬
std::ostringstream oss;
oss << "{ \"key\" : \"value\"}";
mg_printf(conn,
"HTTP/1.1 200 OK\r\n"
"Cache: no-cache\r\n"
"Content-Type: text/plain\r\n"
"Content-Length: %d\r\n"
"\r\n",
oss.str().length());
mg_write(conn, oss.str().c_str(), oss.str().length());
当我在Firefox中打开网页,它工作得很好,我可以看到JSON消息{ "key" : "value"}
。 Firebug对此感到满意,并向我展示了解释的JSON对象。
当我使用$.getJSON("http://127.0.0.1:8080/AtoB", [...])
访问相同的URL时,Firebug显示正确的标题,但显示为空的正文。
我该怎么办? 感谢
附加信息:
- 不与应用/ JSON的工作,要么。为了便于调试,我留下了纯文本/纯文本。
- 不适用于$ .get()或其他。问题在于之前。
- 对原始xmlhttprequest也不起作用!
- 我尝试了最后的\ 0和最后\ n没有运气。
- 原始猫鼬服务器(mongoose.exe)在从jQuery访问时产生相同的行为。