Posts Tagged: ajax


27
Oct 08

Prototype ajax gotcha

If you are one of those who leave the docs as a last resort, you may find that when doing ajax requests with Prototype all requests except get and post are emulated using post and adding a _method parameter.

The code doing this is in ajax.js:

if (!['get', 'post'].include(this.method)) {
// simulate other verbs over post
params['_method'] = this.method;
this.method = 'post';
}

The documentation about this is here: http://www.prototypejs.org/api/ajax/options

The reason for using _method is because not all browsers support delete / put, according to ticket 289, which is a request to change this behaviour.