Ranju Ranju - 3 months ago 9
Ajax Question

How to pass a page URL in codeigniter controller

Im buiding a project in codeigniter..

I need to load a page in popup window

Popup window code is :

<div class='opener' data-addclose='true' data-balloon ='{ajax} grid-content.php?Action=0' style='position:relative; margin: auto; clear: both'>View</div>


grid-content.php is file in application\views\Adv_Product, how to pass this page url (grid-content.php) in my controller...??

I need to view this page contents in a popup.

How can I place this code in codeigniter...

Please help

Thanks in Advance..

Answer

Note : codeigniter does not provide to load directly view,

<div class='opener' data-addclose='true' data-balloon ='<?php echo base_url()?>/demo/popup_view/0' style='position:relative; margin: auto; clear: both'>View</div>

first to make a function inside your controller

Controller name: Demo.php

function popup_view()
{
   // if you send a parameter like action=0 

     $action=$this->uri->segment(3);

    if($action==0)
    {
       $data=array('action'=>'0');
    }
    else
    {
       $data=array('action'=>'');
    }

   $this->load->view('grid-content.php',$data);
}
Comments