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?

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.