i try to use Ajax in my application with Rails 4. To send my js to the client i use :
respond_to do |format|
format.js
end
Catch:
Your console log says:
Processing by Oweb::MainController#setmagasinstatus as HTML
In your controller action, you don't have supported HTML response. That's why you are facing error of UnknownFormat
.
Solution:
Add format: "js"
in your ajax call. For example:
$.ajax url: "/oweb/main/setmagasinstatus", data: 'id=' + id, format: 'js'