Welcome Guest, Not a member yet? Register   Sign In
passing view by Json
#1

[eluser]Ngulo[/eluser]
hi all guys,

i was wondering.... can i pass a main html view page,with json ajax?

i mean.... i'm passing data with json but i would like also to pass a pice of html in the same json array

if i do something like this:
Code:
$asd = array(
'asd'=>1,
'asd2'=>12,
'html'=>$this->load->view('myview')
);

echo json_encode($asd);


data asd and asd2 are passed normally as json array datas, but html doesn't return inside json array,it comes outside of this array and html becomes null

any suggestion?

thanks
#2

[eluser]Mat-Moo[/eluser]
Try 'html'=>$this->load->view('myview', NULL, FALSE); Null for no data, and False to return the view, not send it to the browser.
#3

[eluser]nggakbiasa[/eluser]
does the third parameter set to "TRUE" makes view returning the data ?
#4

[eluser]Mat-Moo[/eluser]
Yes Docs are great Smile http://ellislab.com/codeigniter/user-gui...oader.html and should be TRUE as you point out.




Theme © iAndrew 2016 - Forum software by © MyBB