Ajax in CI - 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: Ajax in CI (/showthread.php?tid=74538) |
Ajax in CI - Tom_LP - 10-06-2019 Dear all, i started 2 years ago writting with CI (i write code in php for > 25Years). I loved the power of Smarty - xajax/Jaxon - Swift. I managed to integrate all of them into CI (plus the hiding of /applications;/core; and so on). Last year i try to update the part of Jaxon-php, but i have no success. Until the version of 2.0-beta28 works, but now newer one. Now i try it again and i strucle on the same problem (never mind here). The developer from jaxon-php (better for jaxon-php/codeigniter) give no response over a year.... So i looked for a alternate for writing AJAX-Application in CI and wonder if all recommendations goes into native JQuery-Ajax-Calls. For a simple Ajax-Call in JQuery i need to wrote 16 Lines of Code in the template (i got it from a example ). To be honest: i like to write PHP-Code, but not more JQuery-Code as needed My lines of codes shows like this: PHP Code: // Initialize of Controller where a AJAX-Call is done after the template is rendered (onload) PHP Code: // Method of a response class to answer a request... PHP Code: // Smarty-Template to send a response to the server side from a single "onchange" ... The example above has no interaction between, but should explain what i mean. I have all changes of data in the place where it should be and have not struggle with different template-files (where the JQuery-Code for a AJAX-Request has to be, as i understand). In my usage, i have only to know what the name of the field (element-ID) is, where i like to place data into.... (of course - most of the time i give the response-method the name as parameter where i like to insert the requested data ) So - my question is: Is there a convenient AJAX-Library that gives the focus back to writing PHP-Code without the need the usage/learning of JQuery/Javascript ? I searched the last weeks around, but had no real success. The last promising result i found is from Mr. ajaxboy (its called cjax), but his library is slited in Version 5.9 over to 2 years... Could someone give me a glue ? Help for upgrading jaxcon-core to the current 2.2.6 is also welcome (it´s a real cool tool, but 2 year old code is a loose cannon ) kr Tom RE: Ajax in CI - jreklund - 10-07-2019 You don't need to use an external library, it's built in into CI 3 and 4. Here are an example on CI 3 I helped a user with earlier. https://forum.codeigniter.com/thread-70310-post-352422.html#pid352422 If you want to do it with plain JavaScript: https://forum.codeigniter.com/thread-71874.html?highlight=ajax |