我很新,很怕jquery。我很快就會克服它,但是我想要實現的是,在表單提交後,會彈出一個提示,告訴它是成功還是失敗。我有這個工作,但它是醜陋的警報彈出窗口。我想要的是靴子警報通知或警報警告。ajax表單提交rails使用引導後回調
我控制器目前正在尋找這樣
def create
@subscription = Subscription.new(subscription_params)
respond_to do |format|
if @subscription.save
format.html
format.js { render :js=>'alert("You have been added to the mailing list");' }
else
format.html
format.js { render :js=>'alert("You have entered an invalid email address");' }
end
end
end
我已經bootstrap.js裝,我只是不知道該如何實現它。
你應該使用jquery'$('#myModal')。modal(options);'參考bootstrap [documentation](http://getbootstrap.com/javascript/#modals) –