I am having a problem getting Rails to render a page when it is
called from javascript/ajax. I posted a detailed question on
StackOverflow but no one has answered yet.` (Rails 5 will not
render POST made from javascript)``
` 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 render.
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 -0500* Processing by LockoutsController#toggle as HTML *
Because I don’t know any other way to go from the fullcalendar
javascript event to the server. . If you have a better approach, 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 do that.
Thanks
Don