I am trying to display a row data in javascript but although that I get the data, I can't display them in this form. I have tried many options for the $row->transcript_text to be displayed but non of them works. Below is my code: Views
<?php if (isset($history)) { ?>
@foreach($history as $row)
<script type="text/javascript">
function splitArray() {
var myStr = JSON.parse(<?php echo json_encode($row->transcript_text);?>);
var strArray = myStr.split(" | 0");
// Display array values on page
for (var i = 0; i < strArray.length; i++) {
$("body").addClass('col-lg-offset-1').append("<h4>" + strArray[i] + "</h4>");
}
}
</script>
<body onload="splitArray()" style="color: lime">
</body>
@endforeach
<?php } ?>
via Muharrem Smakiqi