Autosaving a form in Rails with AJAX
You need to pass the data
param as well, via serialize method:
$.ajax({
type: "POST",
url: "/posts/autosave",
data: $("#new_post").serialize(),
dataType: "script",
success: function(data) {
console.log(data);
}
});