在jQuery中使用X-HTTP-Method-Override? [英] X-HTTP-Method-Override in jQuery?

查看:1234
本文介绍了在jQuery中使用X-HTTP-Method-Override?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在jQuery中为ajax请求执行X-HTTP-Method-Override?

How can I do an X-HTTP-Method-Override for an ajax request in jQuery?

推荐答案

用1.5你现在可以传入标题选项:

With 1.5 you can now pass in a headers option:

$.ajax({
  headers: {
    'X-HTTP-Method-Override': 'DELETE'
  },
  method: 'GET'
  // more parameters...
});

这是在调用'beforeSend'之前设置的,因此它仍然可能被覆盖。请参见 http://api.jquery.com/jQuery.ajax/

This is set before 'beforeSend' is called, so it could still get overwritten. See http://api.jquery.com/jQuery.ajax/

- 修正了错误的语法(不会让我保存少于6个字符编辑,所以写这条消息

-- fixed incorrect syntax (wouldn't let me save with less than 6 character edit, so writing this message

这篇关于在jQuery中使用X-HTTP-Method-Override?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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