If cross domain ajax calls are not allowed then how are you supposed to use the google spreadsheet API

给你一囗甜甜゛ 提交于 2019-12-01 20:24:40

问题


If cross domain ajax calls are not allowed then how are you supposed to do this? Note: obsoleted link. Question updated with relevant section from original page in question.

From link; (Developer's Guide: Protocol v 2.0 – Google Spreadsheets API):

Add a row

To add a row to the table, start by creating an <entry> element containing the relevant data:

<entry>
  <gsx:hours>1</gsx:hours>
  <gsx:ipm>1</gsx:ipm>
  <gsx:items>60</gsx:items>
  <gsx:name>Elizabeth Bennet</gsx:name>
</entry>

Then determine the appropriate URL to send the entry to, known as the POST URL. You can find the POST URL in the list feed's <link> element that has rel="http://schemas.google.com/g/2005#post".

Next, do any necessary authentication, and create an Authorization header for a new POST request as described in the authentication sections of this document.

In the body of the POST request, place the Atom <entry> element you created above, using the application/atom+xml content type.

Now send the request to the POST URL:

POST http://spreadsheets.google.com/feeds/list/key/worksheetId/private/full

Spreadsheets inserts the new row immediately after the last row that appears in the list-based feed, which is to say immediately before the first entirely blank row.


回答1:


Cross domain ajax restrictions are only a browser restriction. If you make a webservice call from the server or another application, you won't be restricted. If you need to do an ajax call though, you could proxy the call through your server.



来源:https://stackoverflow.com/questions/8937848/if-cross-domain-ajax-calls-are-not-allowed-then-how-are-you-supposed-to-use-the

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!