1
약간의 문제로 도와 주셨으면합니다.컨트롤러에서 자바 스크립트 호출하기 Ruby on Rails 3.2.9
나는 ROR 컨트롤러에 몇 가지 코드를 가지고 :
def create
@email = Email.new(params[:email])
respond_to do |format|
if @email.save
format.html { redirect_to root_path }
format.json { render json: @email, status: :created, location: @email }
else
format.html { render action: "new" }
format.json { render json: @email.errors, status: :unprocessable_entity }
end
end
end
그리고 이메일을 저장 한 경우,
if @email.save
나는이 자바 스크립트와 HTML 파일
<div id="notice">OK</div>
에 보여 주었다 될 사업부를 원한다
document.getElementById("notice").style.display = 'block';
하지만 js 파일을 어디에두고 컨트롤러에서 호출해야하는지 모르겠습니다.
감사합니다.
, 그러므로해야하지만이 HTML 템플릿으로. –
컨트롤러에서 템플릿으로 "기호"를 주어야한다고 생각합니다. js power를 사용할 때입니다. – Aaxenon