views:

67

answers:

2

Hello, everyone!

I'm trying to delete a blog post on blogger.com using Blogger API via Prototype Javascript library. Here's my code:

var request = new Ajax.Request(
    'http://www.blogger.com/feeds/'+remoteBlogId+'/posts/default/'+postId
    {
        method:'DELETE',
        requestHeaders:['Authorization', 'GoogleLogin auth='+authKey],
        on200:function(){/*onSuccess*/},
        onFailure:function(){/*onFailure*/}
    }
);

As far as I can see from API description, everything's alright, but when I run this, it fires onSuccess function, but doesn't delete the entry on the server.

I guess that Prototype doesn't work well with HTTP methods other than GET and POST (here's the ticket describing similar problem though proposed patch didn't work for me)

Any help is appreciated!

Thanks in advance, Mikhail.

A: 

You could use jQuery - here's an article that shows how to use REST methods in jQuery Ajax. jQuery is much more known framework than Prototype.

TTT
If DELETE is not supported by the browser, switching to jQuery will not help.
Peter
Solution found - jQuery handles DELETE and PUT methods properly
Mikhail
A: 

Not all browsers support PUT and DELETE - this is regardless of what JS library you're using. See this topic: Are the PUT, DELETE, HEAD, etc methods available in most web browsers?

Peter