我需要通过发送发送json对象,我无法让它工作。我有它,以便它成功返回,但响应是空的,我想不通为什么事情我已经尝试是我需要帮助通过POST发送JSON并获得响应
new Ajax.Request("http://twittersentiment.appspot.com/api/bulkClassifyJsonRequests", {
method: "post",
postBody:JSONstring,
onSuccess: function(transport){
var response = transport.responseText;
alert("[email protected] \n" + transport.responseText + "no response");
},
onFailure: function(){alert("try again")}
});
和
var http = new XMLHttpRequest();
http.open("POST","http://twittersentiment.appspot.com/api/bulkClassifyJsonRequests",true);
http.onreadystatechange = function() {
if(http.readyState == 4)
{
if(http.status == 200)
{
document.write(http.response.data);
}
else
{
alert(http.statusText);
}
}
};
http.send(JSONstring);
这是什么?你只是发布了与我相同的答案,甚至链接到同一篇文章。 – 2011-04-26 14:28:17
34分钟复制面食 – 2011-04-26 17:59:33
@Drackir - 有一项服务被称为维基百科。还有另一项服务称为Google。 Google用于搜索所有内容。维基百科就像一切的信息存储。当您在Google中搜索某些内容时,大多数时候显示的第一个链接都来自Wikipedia。因此,相同的链接。顺便说一下,你的一个upvotes是我的。别客气! – Anurag 2011-04-26 18:07:56