jQuery AJAX:当服务器端验证失败时,如何显示Flash错误消息? [英] Jquery AJAX: How to display the Flash error message when validation on the server side fails?
问题描述
我正在使用Jquery表单插件通过ajax提交表单.我已经在模型中的服务器端设置了验证.现在,当验证失败时,我想使用ajax向用户显示相同的flash [:error]消息.如果验证成功,则可以在请求完成后显示flash [:notice],因为它可用.我该如何显示Flash [:error]?
I am using the Jquery form plugin to submit the form via ajax. I have set up validations on the server side in my models. Now when the validation fails i want to display the same flash[:error] message to the user using ajax. If the validation succeeds I can display the flash[:notice] as it is available after the request is completed. How do i go about displaying flash[:error]?
推荐答案
我找到了.
https://github.com/augustl/live-validations/wiki
如果有人有更好的解决方案,请发表,我会接受的.
If anyone has a better solution, please do post, and I will accept it.
这篇关于jQuery AJAX:当服务器端验证失败时,如何显示Flash错误消息?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!