Ajax Framework (CJAX) for Codeigniter 2.x+ |
[eluser]xorzizten[/eluser]
Hi! I'm about to start a new project using CI, and would like to start learning and using the cjax library. Let it be said that i'm farly new to CI, and just about learned about cjax, so please have me excused if my questions is somewhat 'noob' ![]() I uploaded a new set of CI files and the cjax files to my webserver, changed a few config settings like base_url, encryption_key and a few other basic CI settings. This is a dev server, so all files and folders are in the same root folder, and so far i have not set up any htaccess file. When i access my new project, the CI default works, but when i try to access ajax.php?test/test i get this error: Code: Fatal error: Class 'CI_Controller' not found in /home/14/w213454/www/portal_v2/application/response/test.php on line 3 Where line 3 in response/test.php says: Code: class Test extends CI_Controller { I have tried searching for an answer online, and read around in the cjax documentation, but have not forund an answer that have helped. I'm hoping you guys maby could take some time to help me out on this one ![]() And i'm sorry if this question have been answed before, but if it have, i've not found it. Regards Kjell Arne
[eluser]Ajaxboy[/eluser]
Yes it has, I believe it as to do with strict standards being turned on, you might want to check on that and make sure you turn off strict-standards in your php.ini, what version of Cjax are you using? the latest version (;latest Cjax is currently 5.4) does make an attent to disable it automatically, but you might want to double check and make sure is fully turned off.
[eluser]xorzizten[/eluser]
Hi again, and thanx for a fast reply. As far as i know i have disabled the E_STRICT.. i have set Code: ini_set('display_errors', 1); in ajax.php and Code: error_reporting = E_ALL & ~E_NOTICE & ~E_STRICT But the problem still stands ? I cant seem to figure it out.. I do not have access to the main php.ini file, but can use a local php.ini in my webroot.. And according to the provider the strict standar is possible to disable from my local file.. Regards Kjell Arne
[eluser]Ajaxboy[/eluser]
You might want to try it directly from your php.ini instead of through php, I recall someone had to do that to get it to work. Make sure you restart your server, then try again, if that fails - then it's probably something else.
[eluser]fran-quero[/eluser]
Hello Ajaxboy. Thank you very much for sharing your great Ajax framework. It's awesome, I'm still hallucinated, thinking that it must be magic! I've been playing around with some examples, and trying to replace some .jquery (.js) files with $ajax methods. Most of my tests have worked like a charm, but there is one where I'm stucked. EDIT: Forget the problem description described below. It's solved and explained at the end of the post What I have working in jquery and can't run with cAjax is adding HTML generated by $ajax->call to a select form. I have a zip_code input, and when it loses focus I take populations from the database and generate <option> to fill a select with. I post my code here, so you can illuminate my path: Working example with hardcoded <option> Code: $ajax->Exec('zip', $ajax->update("population", array('innerHTML'=>'<option>Foo</option>')), 'blur'); The problem is when I change hardcoded <option> for an $ajax->call() Code: $ajax->Exec('zip', $ajax->update("population", array('innerHTML'=>$ajax->call('ajax.php?newuser/populations/|zip|'))), 'blur'); EDIT Very easy solution. Just have to do so: Code: $ajax->Exec('zip', $ajax->call('http://localhost/ajax/newuser/populations/|zip|','population'), 'blur'); The only thing I have to find out is why it doesn't work the url ajax.php?newuser... and I have to use the absolute url.
[eluser]Ajaxboy[/eluser]
Hello fran-quero, Thanks so much for the compliment, I really appreciate it. There is a select function in $ajax->select() that allows to deal with dropdowns/select elements. To fill 'select' elements. You just supply an array. Please see these samples: http://cjax.sourceforge.net/examples/pro...opdown.php http://cjax.sourceforge.net/examples/pro...opdown.php This is how it would propagate data into select elements: Code: //Sample1 On third parameter, you specify which item should be the selected default. Hope this helps, and do let me know if you run into any issues. May I ask for a favor?, can you please post your review here: https://sourceforge.net/projects/cjax/reviews/ I will appreciate it even more, thanks!. Update: There are usually more than one way to accomplish things with Cjax, glad you found a solution. Ajaxboy
[eluser]fran-quero[/eluser]
Thank you for the select info, I'll check it out. I have to go deeper in the documentation. Just made my review in Sourforge! Now I have new question. With this code I show a modal if an identification id exists in a database table: Code: $ajax->Exec('id', $ajax->overlay(base_url().'ajax/newuser/checkid/|id|'), 'blur'); It works, but I'd like it to JUST show the modal if the id is found. When an id is not found cAjax shows an empty modal. Is that possible?
[eluser]Ajaxboy[/eluser]
Not too sure without knowing the full scope but generally speaking, when you pull the data from the database, you might want to add a check, for example: Code: if ($id) {
[eluser]fran-quero[/eluser]
It's an alert based on the value introduced by the user, so I can't use if(), because, I search the id in the database once the input field for id loses focus. And this way, although the controller response is empty, $ajax->overlay() shows an empty modal. I'll look for alternative ways. Thank you for your answer.
[eluser]salvomil[/eluser]
Hi Ajaxboy, Could you help me please? How do I execute a synchronous call using cjax? |
Welcome Guest, Not a member yet? Register Sign In |