0

I'd like to use as close to full RESTful style as a browser can manage.

Do Backbone, jQuery, and Zepto to implement the non-browser supported methods PUT and DELETE in the same way? If so, how do they implement this?

Backbone:

myBackbone.model.destroy() // Calls Backbone.sync('DELETE', model, options)

jQuery / Zepto:

$.ajax({ url:'/testUrl', type:'PUT' })
SimplGy
  • 20,079
  • 15
  • 107
  • 144
  • What makes you think browsers don't support PUT and DELETE? They are supported in all major browsers. See http://stackoverflow.com/questions/165779/are-the-put-delete-head-etc-methods-available-in-most-web-browsers – Benjamin Gruenbaum Mar 07 '13 at 23:05
  • Things like this: http://stackoverflow.com/questions/286321/how-can-i-emulate-put-delete-for-rails-and-gwt and this: http://stackoverflow.com/questions/5177595/why-dont-the-modern-browsers-support-put-and-delete-form-methods is this only a limitation for form methods? – SimplGy Mar 07 '13 at 23:07
  • Support for all HTTP methods in *HTML Forms* is not supported in older browsers. That does not apply to JS code. More accurately, AJAX is built on top of: http://en.wikipedia.org/wiki/XMLHttpRequest. So if you want to read limitations (or lack thereof) go there. – Matt Whipple Mar 07 '13 at 23:08
  • Wow, how'd I miss that :) – SimplGy Mar 07 '13 at 23:09
  • @SimpleAsCouldBe Did you try to run any code that failed before asking? IIRC, old browsers support PUT and DELETE via AJAX – Benjamin Gruenbaum Mar 07 '13 at 23:09

1 Answers1

0

Apparently REST is safe to trigger from JS, and has been for ages, just not from HTML forms.

@Matt Whipple:

Support for all HTTP methods in HTML Forms is not supported in older browsers. That does not apply to JS code.

@Benjamin Gruenbaum:

PUT and DELETE... are supported in all major browsers.

SimplGy
  • 20,079
  • 15
  • 107
  • 144