I'm trying to load a view which contains html elements like div etc into an array, but I'm having trouble doing it. Somehow, even if I replace quotation marks, it seems to be causing error. After loading the view into the array
$tmp = $this->load->view('details/action_task');
$result['html'] = str_replace('\\"','\\\\"', $tmp);
$resp = json_encode($result);
on chrome console, output is
{"code":1,"html":""}
<div class="text-center">Response</div>
As you can see html
is empty, and its "should be" value is out of the json object. Any idea on solving this?