Tom DeHart
2011-May-04 05:35 UTC
Why do I sometimes have to refresh the page manually after an AJAX form submission?
When I do remote form submits through jQuery .submit() why do I sometimes have to refresh the page manually to see the results? My jQuery handler is very simple: $("#vote_yes").click(function() { $("#approval").val(true) $(".edit_vote").submit() }); And the link that leverages this bit of code is as follows: <%= link_to("Vote Yes", @ballot, :class => "buttons", :id => "vote_yes") %> After using this link to submit the form on the page, however, sometimes I need to refresh before I see any changes. Why is this? -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jim Ruther Nill
2011-May-04 06:51 UTC
Re: Why do I sometimes have to refresh the page manually after an AJAX form submission?
On Wed, May 4, 2011 at 1:35 PM, Tom DeHart <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org> wrote:> When I do remote form submits through jQuery .submit() why do I > sometimes have to refresh the page manually to see the results? > > My jQuery handler is very simple: > > $("#vote_yes").click(function() { > $("#approval").val(true) > $(".edit_vote").submit() > }); > > And the link that leverages this bit of code is as follows: > > <%= link_to("Vote Yes", @ballot, :class => "buttons", :id => "vote_yes") > %> > >Are you doing this locally? and you only have one instance of your server? For me it looks like you''re doing two requests everytime you click ''Vote Yes''. One submits the form, the other redirects you to @ballot show page. Try adding a return false inside the click bind function. Add just redirect the user to @ballot via js.> After using this link to submit the form on the page, however, sometimes > I need to refresh before I see any changes. Why is this? > > -- > Posted via http://www.ruby-forum.com/. > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- ------------------------------------------------------------- visit my blog at http://jimlabs.heroku.com -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe Matching Threads
- Polycom 330 not dialing 4 digit extensions beginning with 11xx
- Pre-populating association
- [RFC] Adding thread group semantics to LangRef (motivated by GPUs)
- [RFC] Adding thread group semantics to LangRef (motivated by GPUs)
- [RFC] Adding thread group semantics to LangRef (motivated by GPUs)