Can not parse json using this
var res = eval('(' + response + ')');
The response
contain [{"total_sections":"3"}]
this value. But i couldn't take the value total_sections
.
function changeSection() {
id = document.getElementById('layoutDropdown').value;
$.ajax({ type: "POST",
url:'/manage',
data: {id : id },
success: function(response){
alert(response);
var res = eval(response);
alert(res[0].total_sections);
}
});
}
manage Layouts:
public function manageLayouts() {
$id = $_POST['id'];
$data = $this->managelayoutmodel->getSections($id);
echo json_encode($data);
}