Could someone tell me why this PUT method doesn\'t work please.
$.ajax({
type: \"PUT\",
dataType: \"script\",
url: \'/resources/35\',
Rails determines the put request via the parameter _method with the value 'put'.
As not all the browsers support the put method, rails cheats in the form_tag. its putting this output in a PUT form:
So what you have to do is this:
$.ajax({
type: "POST",
dataType: "script",
url: '/resources/35',
contentType: 'application/json',
data: JSON.stringify({ resource:{pos_y:45,pos_x:50}, _method:'put' })
}).done(function( msg )
{
alert( "Data Saved: " + msg );
});