I am having a problem getting Rails to render a page when it is called
no one has answered yet.(Rails 5 will not render POST made from
Basically, I am doing a very simple ajax POST (also tried GET with same
results), the equivalent of: localhost:3000/lockout/2016-03-16.
The ajax request gets past routes.rb, and calls the appropriate method
in the controller. The controller processes it correctly (database is
updated, debug print statements show up in log, etc.) but it does NOT
When I submit the same request manually from the browser (as a GET) it
again is processed correctly, but then it DOES render.
In all cases the log shows this (with times slightly different):
/Started POST “/lockout/2016-03-16” for 127.0.0.1 at 2016-03-06 13:05:22
//Processing by LockoutsController#toggle as HTML//
/Rendered lockouts/toggle.html.erb within layouts/application (0.6ms)//
//Completed 200 OK in 244ms (Views: 203.0ms | ActiveRecord: 11.4ms)/
In fact, the log shows identical entries from the original /Started
GET/POST/ line for all attempts at invoking the method, but only when
the URL is entered manually will the view render.
BTW, the ajax is called from fullcalendar’s dayClick event if that
helps. fullcalendar’s eventClick events DO render.
The ajax request gets past routes.rb, and calls the appropriate method in
Processing by LockoutsController#toggle as HTML
BTW, the ajax is called from fullcalendar’s dayClick event if that helps.
fullcalendar’s eventClick events DO render.
Does anyone have any ideas?
Can you show us the code you are you using to do the post?
This is the whole thing (including alerts to let me know when clicks are
when clicks are
made the difference. It works now.
Thank you Colin,
I’m rather curious, if what you want is a full page reload at that
point, why you’re bothering using AJAX?
Because I don’t know any other way to go from the fullcalendar
please tell me how. It is never too late to learn something new (I’m 73
years old and started programming in the late 1950’s. I’ve been
learning a lot of new things since then ).
I would really like to process the dayclick event on the server, prompt
the user for a response, then reload the page. That implies that I need
to render html or json to do the prompting, then reload the page with
data conditioned on the user’s response. So far I haven’t been able to
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.