I’m trying to post comments using Ajax. It seems that I have an
infinite loop somewhere, because it hangs on the return from the Ajax
call. The comment does get saved to the DB, but I have to refresh the
page for it to show.
The reason I know it’s some sort of infinite loop, is because I’m
showing a “loading.gif” image, and it never goes away. Plus, if the
comment doesn’t save, I’m returning an error message. I’ve posted the
code for the VIEW and CONTROLLER below. Please HELP!
I’m trying to post comments using Ajax. It seems that I have an
infinite loop somewhere, because it hangs on the return from the Ajax
call. The comment does get saved to the DB, but I have to refresh the
page for it to show.
My guess is that your getting hung up on a javascript syntax error. The
loading gif never goes away because the javascript hits an error half
way and never finishes executing.
First, I recommend that you use the firebug extension for firefox, as it
lets you inpect the query, and response of AJAX calls super easily.
Second, turn on RJS error reporting by adding the following to
config/environments/development.rb
RJS Error reporting
config.action_view.debug_rjs = true
That should make anything that goes wrong popup in an alert box.
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.