【发布时间】:2011-06-13 17:19:23
【问题描述】:
我想在授权用户后写回我的谷歌电子表格。授权完成。但是,要写回电子表格,我已发送 PUT 请求,如 here 所述。它来自 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 密钥。它类似于我的电子表格网址中的键。
【问题讨论】:
-
闻起来像 StackOverflow.com 的问题...
-
您能检查一下请求的实际提交位置吗?您可以为此使用 firebug/开发者工具。
-
您使用的是哪个浏览器?根据 jquery 文档,并非所有浏览器都支持
PUT和DELETE请求类型。你能检查一下POST会在哪里解决你的问题吗?