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.