CodeIgniter Forums
load view onclick of href - 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: load view onclick of href (/showthread.php?tid=22384)



load view onclick of href - El Forum - 09-08-2009

[eluser]sheri.nust[/eluser]
Hey i am new to CI,

can anyone help me in following problem,

i am using href tag in my view
<a href="[removed]void(null)">Home</a>

what i want to do is , when i click above link,
it would load view with data array like

&lt;? $this->load->view('home_view',$data); ?&gt;


load view onclick of href - El Forum - 09-08-2009

[eluser]nandish[/eluser]
try this....
&lt;?php
class ctest extends controller{

function __construct() {
parent::controller();
}

function redirect() {
$data['result'] = "Nandish";
$this->load->view('viewpage',$data);
}

} ?&gt;


javascript

function redirect() {
[removed] = "/ctest/redirect";
retrun true;
}

&lt;a href='#' onlcik ='redirect()' &gt; Click here to load view page &lt;/a &gt;