在用户授权后,我希望能够写回到我的Google电子表格中。授权已经完成。但是,为了将数据写回电子表格中,我需要像这里所述一样发送PUT请求。这是来自iGoogle小工具的。
我的XML元素是:
var cellUrl = "https://spreadsheets.google.com/feeds/cells/" + key + "/od6/private/full/R2C2";
var XMLData = "<entry xmlns='http://www.w3.org/2005/Atom' xmlns:gs='http://schemas.google.com/spreadsheets/2006'>" +
"<id>" + cellUrl + "</id><link rel='edit' type='application/atom+xml' href='" + cellUrl + "'/>" +
"<gs:cell row='2' col='2' inputValue='300'/>" +
"</entry>";
我正在发送的AJAX请求如下:
$.ajax({
url: cellUrl,
type: "PUT",
contentType: 'application/atom+xml',
processData: false,
data: XMLData,
error: function(XMLHttpRequest, textStatus, errorThrown){
alert(errorThrown);
}, success: function(data, textStatus, XMLHttpRequest){
alert("Succeeded");
}
});
然而,它没有回复并且也没有显示任何警报!问题出在哪里?
我应该使用POST方式进行回复吗?我该怎么做?
为了安全起见,我已经隐藏了cellURL密钥。它与我的电子表格url中的密钥类似。
PUT
和DELETE
请求类型。你能否检查一下是否可以使用POST
来解决你的问题。 - Arun P Johny