I have an array in my javascript file app/assets/javascript/pages/books_page.js :
var booksPage = Backbone.Model.extend({
defaults: {
authors: []
}
...
How can I pass that to my controller as a param. The path of my controller is app/controllers/books_controller.rb ?
I think I might need an ajax request and tried the following but it is not working:
$.ajax({
type: "post",
url: "/books_controller",
data: { list_authors: this.get('authors') },
});
Specifically, I am not sure what the url needs to be. Your help here will be greatly appreciated. Thanks.