Dropdown - add records without refresh form |
Is there a way to add records to a dropdown menu without refresh of the page ?
Thanks for your time.
Website : www.my-web-projects.com
(01-19-2015, 03:00 PM)josepostiga Wrote: Yes. Use ajax calls. I was looking into it but with no success so far .. if you have time can you provide more informations ? Thanks for your time
Website : www.my-web-projects.com
If the state is add, create a button on the div for adding a new record :
Code: <?php if($state == 'add') { ?> Bootstrap normal model : Code: <div class="modal fade bs-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> ajax : Code: <script type="text/javascript"> controller ( I have added here the model just for test ) Code: public function add() {
Website : www.my-web-projects.com
I manage to fix my code .. but i have come upon a different problem .. This is not related to CI but if someone else come across the problem and know a solution ...
Code: success:function(tdata) In the ajax success i manage to close the model and now trying to refresh the chosen dropdown menu ... I have tried Code: $('.chosen-select').trigger('liszt:updated'); but with no luck ... so if anyone know a solution or has any ideas .... Thanks for you time.
Website : www.my-web-projects.com
Code: $(".chosen-select").append("<option value='31'>A new option!!</option>");
(01-21-2015, 02:21 PM)CroNiX Wrote: Thanks with some changes i manage to fix my problem.
Website : www.my-web-projects.com
|
Welcome Guest, Not a member yet? Register Sign In |