jquery post codeigniter验证 [英] jquery post codeigniter validation

查看:138
本文介绍了jquery post codeigniter验证的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们使用jquery将.load()一个表单转换为div

We are using jquery to .load() a form into a div

然后我们使用jquery来形成一个代码控制器/ post

We then use jquery to .post() that form to a codeigniter controller ie /app/post

然后,我们要让Codeigniter执行验证,但不知道如何返回页面来显示验证错误?如果re reload()控制器不会重新初始化对象,我们失去了数据?

We then want Codeigniter to perform validation but were not sure how to return to a page to display the validation errors? If re re .load() the controller wont it re-init the object and we lose the data?

我们是否以错误的方式接近?

Are we approaching this in the wrong way?

推荐答案

将验证消息存储在控制器的会话中,然后在相应的视图/页面上显示验证消息,但如果所有验证都由用户正确完成您应该再次销毁该会话。

Store the validation messages in sessions from your controller and then show them on the corresponding view/page but if all validation is done correctly by the user the you should destroy the session again.

这篇关于jquery post codeigniter验证的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆