B
B
Baha Rustamov2016-03-17 12:04:14
JSON
Baha Rustamov, 2016-03-17 12:04:14

How to display text from json?

Here is the response from the server: pastebin.com/Dc8wz9cB
How to display the country ID and name?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
Y
Yuri, 2016-03-17
@modestguy

countries[0][0] // 19
countries[0][1] // Australia
countries[1][0] // 20
countries[1][1] // Austria

A
artem_music, 2016-03-17
@artem_music

This will output to the console:

json.countries.forEach(function(country) {
    console.log(country[0]+ ' : ' +country[1]);
});

This will output in body:
json.countries.forEach(function(country) {
   $("body").append(country[0]+ ' : ' +country[1]+'<br>');
});

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question