Ajax response issue when validating form |
[eluser]Unknown[/eluser]
hello people , I'm facing a problem with CodeIgniter form validation. I am passing form data to a controller using AJAX. but seems its never execute the form_validation function or validation_errors() function. But i am getting form data correctly. when I echo $this->input->get('any_form_field'), it output that field value. this is the controller action: Code: public function add() This is my scripts in the view file Code: $(function () { here is my validation rules. Code: $config = array( in the view file where the scripts are present, I am showing two alert. first shows the correct output (as the validation function never execute it always show false), but the second alert always shows empty.:ohh: WHY it shows an empty alert message. it should show the validation_errors() message or the success message. one more thing, i am using CI template library: http://williamsconcepts.com/ci/codeignit.../template/ anyone please help. I am really depressed about this one. Thanks.
[eluser]Unknown[/eluser]
Finally I found the problem. CI form validation doesn't work with GET. So, I copied the GET array into the POST array and it works fine :cheese: Thanks
[eluser]Unknown[/eluser]
I think this is related to CSRF being turned on. Check your config.php file and see. |
Welcome Guest, Not a member yet? Register Sign In |