Welcome Guest, Not a member yet? Register   Sign In
AJAX calls existing functions / methods
#1

[eluser]Unknown[/eluser]
Hello Smile,

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 Undecided...

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




Theme © iAndrew 2016 - Forum software by © MyBB