Created
July 11, 2014 16:21
-
-
Save breim/096c439652ecc47ad54e to your computer and use it in GitHub Desktop.
Carregar JS dentro do controller
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Controller | |
def nome_da_action | |
format.html {redirect_to :back, notice: "Enviado!"} | |
format.js | |
end | |
# Dentro da view do controle, o arivo nome_da_action.js.erb | |
# Aqui você chama os paranauê do javascript. no meu caso, eu dou um render partial e deixo a div contatohide, escondida. | |
$('#contato').html("<%= escape_javascript(render :partial => 'success') %>"); | |
$('#contatohide').hide(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment