ruby on rails 3 - Js.erb renders only once -
I have a vote button in the hidden device that loads using the pyroxbox. The trigger link is:
& lt; Div class = "inliner" & gt; & Lt; A href = "# vid_ & gt; Rel = "inline-1000-500" class = "pirobox_gall1" & gt; & Lt; H5 & gt; & Lt;% = c.title% & gt; & Lt; / H5> & Lt; / A & gt; & Lt; / Div & gt; And in my Hidden Div, I have the following for my vote button:
, button_to 'vote', vote_path (: format = & Gt ;: js ,: id = & gt; c.id),: remote = & gt; True% & gt; And in the controller I have:
DF vote @ video = video.fund (param [: id]) @ video. In crit! (: Vote) response_to do | Format | Format.js {Render: Layout = & gt; In the end, in my JSRB, I have: $ ('p # success_ & lt;% = @ video (% slower); and end Code>
When the trigger link is clicked, the peroxox is loaded as hidden content. When I click on the vote button, the vote increases and the JSRB file is also provided. Everything works fine but, now I turn off the Pyroobox popup, then trigger it again and click on the vote button. The vote field has increased, but jserb has not been provided :( How do I fix it? <
Let's clear your code a little bit;
Your button:
& lt;% = button_to 'Vote', Vote_path (C), Remote = & Gt; Correct% & gt; Your Controller:
def vote @ video = video .find (params [: id]) @ video .increment! (: Vote) End Your JS:
$ ('# success_ & lt;% = @ Video.id% & gt; 'FadeIn (' slow '). Delay (1000). FadeOut (' Slow '); Now run firebug and trace your AJAX calls through the console
Comments
Post a Comment