Welcome Guest, Not a member yet? Register   Sign In
can i call a controller in view ?
#1

[eluser]minhbu[/eluser]
hi !
i want to call a controller in view.Can it do it ?
#2

[eluser]GrootBaas[/eluser]
Sure, try using AJAX ...

Something like this ...

Code:
$.ajax({
                               url: "<?=base_url()?>logs/get_regos",
                            global: false,
                              type: "POST",
                             async: true,
                          dataType: "html",
                              data: "acc_code="+ cust_code,
                           success: function (response) //'response' is the output provided by the controller method prova()
                           {
                           //counts the number of dynamically generated options
                           var dynamic_options = $("#log_rego").index( $('.dynamic')[0] );
                          //removes previously dynamically generated options if they exists (not equal to 0)
                           if ( dynamic_options != (-1)) $(".dynamic").remove();
                           $("#log_rego").append(response);
                           $('#log_rego').find('option').slice(0,1).attr({selected: 'selected'});
                       }
              });
#3

[eluser]minhbu[/eluser]
have any funtion same include function ?
i want to do same include function.
#4

[eluser]GrootBaas[/eluser]
[quote author="minhbu" date="1224578298"]have any funtion same include function ?
i want to do same include function.[/quote]

Not sure what you are asking ...

but ...

url: "<?=base_url()?>logs/get_regos",

logs = The controller
get_regos = function inside controller
#5

[eluser]narkaT[/eluser]
what exactly do you want to archive?
#6

[eluser]Colin Williams[/eluser]
Views almost always call other controllers, typically with hyperlinks, and sometimes with Ajax (just make sure there is a non-Ajax fallback).




Theme © iAndrew 2016 - Forum software by © MyBB