I need help developing JS code (or PHP if it will be easier and more efficient) that can loop through INI comments, sections, settings and their values.
For example, this is my PHP:
<?php
$ini_array = parse_ini_file("sample.ini", true);
print_r(json_encode($ini_array));
?>
Here is the JSON that my PHP is outputting:
{"HEADINGONE":{"settingone":"hello","settingtwo":"world"},"HEADINGTWO":{"settingthree":"hi","settingfour":"again"}}
Which is parsing this INI file:
[HEADING ONE]
settingone=hello
settingtwo=world
[HEADING TWO]
settingthree=hi
settingfour=again
And this is my JS:
$.getJSON('index.php', function (data) {
$.each(data, function (i,item) {
alert(i);
});
});
So far my webpage alerts "HEADING ONE" and "HEADING TWO" but how can I get it to read the rest of the file?
So I can alert "HEADING ONE", "settingone", "hello", "HEADING TWO", and so forth.