How do I do a PUT, POST or DELETE call from javascript?
I've collected some data using jquery drag and drop. How do I then send this to the database? I think I might be able to use jQuery.ajax but can't work out how exactly.
Any pointers appreciated.
Solution:
This is the javascript that works
$(document).ready(function() {
$.ajax({
type: "PUT",
url: "/articles/8", // should be mapped in routes.rb
data: {articles:{name:"New Name"}}
});
});
But it doesn't change the name of article 8 to New Name. Firebug shows no errors, but I still can't pass data to the edit.
The url is the standard update using put url, it exists in the routes.