I have the following json document
// json.json
[
{
"title":"title1",
"value":12234
},
{
"title":"title2",
"value":"some text"
},
{
"title":"title3",
"value":"12qwerty234"
},
{
"title":"title4",
"value":123.5
}
]
I am using jQuery to load it. Here is the code:
$(document).ready(function(){
$.getJSON("json.json", {},function(result){
$.each(result, function(i, obj) {
$("form").append($('<label for="'+i+'">'+obj.title+'</label>'));
$("form").append($('<input id="'+i+'" value="'+obj.value+'" type="text"/><br>'));
});
});
});
My problem is, that I am getting a syntax error in Firefox. I load json.json
as a local file.
Here is a screenshot (the error says "syntax error at line 1")
Note, that form has been generated successfully.
Edit :
Here is another screenshot from Chrome when running python SimpleHTTPServer
: