HTTP补丁XmlHtt prequest支持 [英] HTTP Patch XmlHttpRequest support

查看:149
本文介绍了HTTP补丁XmlHtt prequest支持的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我工作的一些待办事项应用程序,并想用HTTP方法PATCH添加和删除TODO的,因为这将是语义不是把更好的。

I am working on some todo app and would like to use the HTTP method PATCH to add and remove todo's because this would be semantically better than PUT.

在后端我使用前press.js(node.js中)和前端Backbone.js的(使用jQuery的阿贾克斯)。

In the backend I am using express.js (node.js) and in the front-end backbone.js (which uses jQuery for ajax).

如果它实际上是在后台和前端工作在我的本地的研究与开发套件我已经尝试过(的Archlinux,铬20,Node.js的0.8,前preSS 2.X)和它的工作:

I already tried if it actually works in back- and front-end on my local developement suite (Archlinux, Chromium 20, node.js 0.8, express 2.X) and it worked:

app.js

app.patch('/todo/:id', function(req, res){
    console.log('patch successfull');
}

铬Web控制台

$.ajax({ 
    url: '/messages/4ff13720f00e2e2c4b000006',
    type: 'PATCH',
    data: { body: 'that is a patched message' } 
});

请求被提及,也是数据库操作在可能的情况没有异常。

The request was mentioned and also database actions where possible without exceptions.

我现在想知道如何其他浏览器都支持打补丁方法。我看着与谷歌的,但它是很难找到的东西,因为补丁多重含义...

I would now like to know how other browsers support the patch method. I looked with google but it is hard to find something because PATCH has multiple meanings...

推荐答案

大多数浏览器限制HTTP方法在应用到形式GET / POST。然而,只要作为后端服务器可以支持它将工作的方法AJAX请求。

Most browsers restrict HTTP methods to GET/POST when applied to forms. However, with AJAX requests as long as the backend server can support the method it will work.

这篇关于HTTP补丁XmlHtt prequest支持的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆