I have created a JSON file with variable in it . But I am unable to assign the value to variable from JSON.
My HTML file is :--
<div class="col-xs-9 text-right">
<div class="huge">
<p id="demo"></p>
</div>
<div>Total</div>
</div>
My Javascript is :--
<script>
var text = 'http://localhost:8080/SampleGUI/total.txt';
var obj = JSON.parse('text');
document.getElementById("demo").innerHTML = obj.total;
</script>
And my JSON is :--
{
"text": {
"total":"19838"
}
}
I keep getting invalid character error for my HTML variable assignment .
Can you please help me with same ?
Regards.