用户数据validation无效

我正在尝试使用CodeIgniter和jqueryvalidation登录表单。 我正在使用CodeIgniter的form_validation库。 当用户单击登录按钮时,表单将被提交并调用jquery函数。如果数据有任何问题,控制器函数会将错误消息作为json传递给jquery函数。 问题是错误消息没有显示在表单中。 唯一显示的是空白页面中的json数组。 这是html form

 <form class="col-md-12 center-block" action='hyr/proceso' method='post' name='proceso' id='hyrForm'> 

这是jquery函数:

 function hyr() { $(".text-danger").remove(); $(".form-group").removeClass('has-error').removeClass('has-success'); $("#hyrForm").unbind('submit').bind('submit', function() { $.ajax({ url: form.attr('action'), type: form.attr('method'), data: form.serialize(), dataType: 'json', success:function(response) { if(response.sukses===false) { $('.text-danger').remove(); if(response.mesazhe instanceof Object) { $.each(response.mesazhe, function(index, value) { var id = $("#"+index); id .closest('.form-group') .removeClass('has-error') .removeClass('has-success') .addClass(value.length > 0 ? 'has-error' : 'has-success') .after(value); }); } else { $(".mesazhe").html(''); } } } }); }); } 

部分控制器function:

  $validues = array('sukses' => false, 'mesazhe' => array()); $this->form_validation->set_rules($config); $this->form_validation->set_error_delimiters('

','

'); if($this->form_validation->run() === true) { $rezultati = $this->validim->validim(); if($rezultati){ $e=$this->input->post('email'); if($e=='admin@yahoo.com'){ redirect('lista_perdoruesve'); } else{ redirect('perdorues_faqjaKryesore'); } } else{ $validues['sukses'] = false; $validues['mesazhe'] = "Nuk ekziston asnje perdorues me keto te dhena!"; } } else{ $validues['sukses'] = false; foreach ($_POST as $key => $value) { $validues['mesazhe'][$key] = form_error($key); } } echo json_encode($validues);