I'm trying using ajax with rails-ujs but my call doesn't doing nothing. The application use the rails 5.1 and have the rails-ujs require in application.js
When i test the code in a browser console, it is return false.
Bellow is the code:
Rails.ajax({
url: "/notifications.json",
type: "GET",
success: function(data) {
console.log(data)
}
})
To makes the ajax call work with rails-ujs(without jQuery) i don't found any documentation at moment and hope this code bellow helpes.
Rails.ajax({
dataType: 'script',
url: "/notifications.json",
type: "GET",
beforeSend: function() {
return true
},
success: function(data) {
console.log('Ajax fine!')
}
})