![]() |
How fill input fields with ajax - 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: How fill input fields with ajax (/showthread.php?tid=63086) |
How fill input fields with ajax - kamusksn - 09-24-2015 Hello, I have a question about how to handle this situation. I'm creating an edit page, I have and input field for the user to type the "ID" of the record I want to modify and a search button, when the user click on the search button I want to populate the form and if anything need to be changed give to the user the option to do that. Controller ncmr PHP Code: class ncmr extends CI_Controller { View ncmr_edit Code: <html> So basically I'm showing the results on the ncmr_edit, but I would like to populate the ncmr field with the data from the query. Code: RE: How fill input fields with ajax - Wouter60 - 09-24-2015 Make your controller generate the value for the ncmr_num field only. Echo that out, so it will be returned to the Jquery script. Also give the ncmr_num field an ID, e.g. id="ncmr_num". Then, in the success part of AJAX, put $('#ncmr_num').val(data); |