Welcome Guest, Not a member yet? Register   Sign In
calling the right method after ajax call
#6

[eluser]stoefln[/eluser]
the problem is that i call a method "deleteImages" in my controller by AJAX. after deleting the images i want to retrieve the html of the controller-method which is linked to the url where i got from.
Code:
class Test_controller extends Controller {
    
    function Test_controller()
    {
        parent::Controller();
    }
    
    function index()
    {
       // I am the index method, and I load the index view.
    }

    function get_images_by_category()
    {
        // I am the get_images method, and I load the get_images view.
        ...
    }
    function get_images_by_user()
    {
        // I am the get_images method, and I load the get_images view.
        ...
    }
    function get_images_by_date()
    {
        // I am the get_images method, and I load the get_images view.
        ...
    }
    function delete_images($imageIds)
    {
        deleteImages();
        switch($this->uri->segment(3)){
           case "get_images_by_user":
             html = $this->get_images_by_user(params...);
             break;
           case "get_images_by_date":
             html = $this->get_images_by_date(otherParams...);
             break;
           case "get_images_by_category":
             html = $this->get_images_by_category(params...);
             break;
           case "whatever"...
        }
        // return ajax response
        return html;
    }
}
what i m trying to say is that i have to rebuild the whole routing algorithm by a switch, and i think thats not very sexy. so i was wondering if there is another way...


Messages In This Thread
calling the right method after ajax call - by El Forum - 02-15-2009, 05:28 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 05:31 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 05:53 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 06:22 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 06:23 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 06:43 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 06:57 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 07:00 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 07:24 AM
calling the right method after ajax call - by El Forum - 02-15-2009, 07:33 AM
calling the right method after ajax call - by El Forum - 02-16-2009, 05:52 AM
calling the right method after ajax call - by El Forum - 02-16-2009, 06:25 AM
calling the right method after ajax call - by El Forum - 02-16-2009, 06:35 AM



Theme © iAndrew 2016 - Forum software by © MyBB