![]() |
AJAX calls existing functions / methods - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: AJAX calls existing functions / methods (/showthread.php?tid=58981) |
AJAX calls existing functions / methods - El Forum - 08-11-2013 [eluser]Unknown[/eluser] Hello ![]() I have some trouble by finding a pattern about how to manage ajax calls to existing functions / methods. For Example I have got a model called "profile". Now Im searching for the best way to call my model's methods. Let's just say I'd like to use the method "delete_profile" which also needs an "id" parameter to determine which profile to be deleted in my database. I made a subfolder called "ajax" within my controller directory. Inside that directory there is my "ajax.php" controller which also uses its very own config where I explicitly allow the usage of functions inside an array ($config['functions']). Don't know if this was a good idea ![]() So how do you guys manage your ajax-calls? Do you seperatly built classes and methods just for ajax or do you (that's what I prefer - but don't know how) use some kind of Ajax controller which makes an instance of the needed object and calls the method with the given parameters? I just feel a bit lost... The solution can't be the direct acces through basic controllers like /profile/profile_delete/83... I want it to be done like that: ajax/profile/profile_delete/83 - or isn't that a good idea?! I would be very glad for any suggestions - just tell me how you would manage a clean call with no double function creation. Kind Regards, Mike |