javascript - "NetworkError: 405 Method Not Allowed" on Google contact delete - Stack Overflow

I am trying to delete a Google Contact through javascript. As per v3 of Google Contacts api I have defi

I am trying to delete a Google Contact through javascript. As per v3 of Google Contacts api I have defined:

scope to 

And authenticated user, and got the access_token. And as per the v3 documentation on this page, trying to delete a contact like this:

$.ajax({
url: '/[email protected]?access_token=ya29.AHES6ZQoqUgoYmDzXyo-WsSlKv1-_2D_HzmXuH-wBuTR3e1ADxO0VWM',
type: 'DELETE',
success: function(res)
{
    console.log(res);
},

error: function(error)
{
    console.log(error);
}
}); 

Getting this error:

   "NetworkError: 405 Method Not Allowed - /[email protected]/full/[email protected]?access_token=ya29.AHES6ZQoqUgoYmDzXyo-WsSlKv1-_2D_HzmXuH-wBuTR3e1ADxO0VWM"

Any help would be appreciated. Thanks.

I am trying to delete a Google Contact through javascript. As per v3 of Google Contacts api I have defined:

scope to https://www.google./m8/feeds

And authenticated user, and got the access_token. And as per the v3 documentation on this page, trying to delete a contact like this:

$.ajax({
url: 'https://www.google./m8/feeds/contacts/default/full/[email protected]?access_token=ya29.AHES6ZQoqUgoYmDzXyo-WsSlKv1-_2D_HzmXuH-wBuTR3e1ADxO0VWM',
type: 'DELETE',
success: function(res)
{
    console.log(res);
},

error: function(error)
{
    console.log(error);
}
}); 

Getting this error:

   "NetworkError: 405 Method Not Allowed - https://www.google./m8/feeds/contacts/[email protected]/full/[email protected]?access_token=ya29.AHES6ZQoqUgoYmDzXyo-WsSlKv1-_2D_HzmXuH-wBuTR3e1ADxO0VWM"

Any help would be appreciated. Thanks.

Share Improve this question asked Oct 30, 2013 at 7:03 Laique AliLaique Ali 572 silver badges8 bronze badges 0
Add a ment  | 

2 Answers 2

Reset to default 5

You are experiencing something called CORSS (Cross-Origin XMLHttpRequest)

if you open chrome dev tools you will see that the browser ignored your 'delete' type and sent OPTIONS instead.

this is happening when you try to call a server from other origin, the browser will fire an extra request with data type OPTIONS to the server to know what is required in order to send your original delete post.
The problem is that the server is not allowing 'OPTIONS' method type. if you ask me, ill try to find proxy (jsonp) service for google contact . or an api

Please have a look here: https://developers.google./api-client-library/javascript/start/start-js

I think you should use their standard api for that.

Please see my answer here .

Make use of the google client api for javascript.

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745115830a4612122.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信