[Solved] Validate whether data entered in the input exists in the database - JQUERY - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forumdisplay.php?fid=5) +--- Forum: General Help (https://forum.codeigniter.com/forumdisplay.php?fid=24) +--- Thread: [Solved] Validate whether data entered in the input exists in the database - JQUERY (/showthread.php?tid=75793) |
[Solved] Validate whether data entered in the input exists in the database - JQUERY - RRIOS - 03-17-2020 I have 3 inputs in the view. They 3 together identify a class from the school. (name, year and semester). So my idea was to validate these values before the submit button does all the data verification. I researched and found this example. Look the last example: https://pt.stackoverflow.com/questions/147355/jquery-verifica%C3%A7%C3%A3o-campo-banco-de-dados-php But, it is not calling the controller / method. The view´s inputs : PHP Code: <div class="form-group col-md-4"> This is a button in a View. PHP Code: <div style="text-align:right"> PHP Code: <script> Controller: PHP Code: public function verifica_turma() Model : PHP Code: function check_turma() Routes.php PHP Code: $route['default_controller'] = 'Dashboard'; RE: Validate whether data entered in the input exists in the database - JQUERY - RRIOS - 03-19-2020 The first problem was solved: I was using jquery slim and this jquery does not recognize $ .ajax RE: Validate whether data entered in the input exists in the database - JQUERY - RRIOS - 03-19-2020 (03-19-2020, 08:30 AM)RRIOS Wrote: The first problem was solved: I was using jquery slim and this jquery does not recognize $ .ajax I was instructed to remove all html from the Controller that has the ajaxrequestpost method. Every Controller of mine has, in the index, calls to header, side menu and footer. And those contain html. So I created a Controller using only the ajaxrequestpost method. Remembering that this method is just a draft for me to try to make $ .ajax work. See that I invented an array. PHP Code: <?php When entering the Controller address, the return is the list in Json. {"tipo":"APARTAMENTO","rua":"BARAO DE MIRACEMA","bairro":"CENTRO","cidade":"CAMPOS DOS GOYTACAZES"} But, it keeps returning HTML from the header. RE: Validate whether data entered in the input exists in the database - JQUERY - RRIOS - 03-19-2020 Problem solved : https://pt.stackoverflow.com/questions/440677/por-que-a-fun%c3%a7%c3%a3o-json-encode-php-n%c3%a3o-est%c3%a1-retornando-dados-no-formato-json/440758#440758 |