Hello Friends,
I got this method after so many surfing, I hope this will help you for read PHP array to the jQuery.
Using this can get the PHP array in JavaScript array!
Hope, this will useful to you !
I got this method after so many surfing, I hope this will help you for read PHP array to the jQuery.
Using this can get the PHP array in JavaScript array!
PHP
<?php
$file = "Path of File Name";
$csv = new Varien_File_Csv();
$data = $csv->getData($file);
Print_r($data); /*This will give Array of CSV file data*/
?>
<script type="text/javascript">
var sample = new Array();
var vals = 'sample ';
sample [vals] = '<?php echo json_encode($data) ?>';
var sample_data = JSON.parse(sample ["sample"]);
</script>
$file = "Path of File Name";
$csv = new Varien_File_Csv();
$data = $csv->getData($file);
Print_r($data); /*This will give Array of CSV file data*/
?>
<script type="text/javascript">
var sample = new Array();
var vals = 'sample ';
sample [vals] = '<?php echo json_encode($data) ?>';
var sample_data = JSON.parse(sample ["sample"]);
</script>
Hope, this will useful to you !
No comments:
Post a Comment