A
A
A person from Kazakhstan2017-03-21 03:48:06
JavaScript
A person from Kazakhstan, 2017-03-21 03:48:06

Why is there an error when reading JSON?

Error downloading JSON , why ?

<!DOCTYPE html>
<html>
<body>

<h2>Create Object from JSON String</h2>

<p id="demo"></p>

<script>

var obj = JSON.parse('{ "name":"John", "age":30, "city":"New York"}');
document.getElementById("demo").innerHTML = obj.name + ", " + obj.age " , " + obj.city ;

</script>

</body>
</html>

obj.city not being read

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stalker_RED, 2017-03-21
@LenovoId

MaxKorz has already pointed out where the error is.
For the future, open the console (f12), there will be an error message, if you click on it, they will even show exactly where.LO49uwW.png

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question