Jefferson X Masonic Jefferson X Masonic - 3 years ago 78
Javascript Question

How do I get a list of users from the Json API?

I want to download the AJAX user list available at http://zadanie.laboratorium.ee/users.json, And I would like to display

1.The number of all users,
2.The Number of active users,
3.The Number of active women,
4.The Number of active men,

from JSON API, using jquery/javascript etc,

How can I achieve this? or can some one provide me a simple tutorial to start with?

Here is what I have done so far :

CODE:

<script>

function ViewData()
{

$.getJSON("http://zadanie.laboratorium.ee/users.json",
function(data)
{
var items = [];

$.each(data.Users,
function(key, value)
{
items.push("<li>" +
value.username + "<br />" +
value.active + "<br />" +

+ "</li>");
});
$('<ul/>', {html: items.join(")}).
appendTo('body');
});
}
</script>


Any help or any idea will be appreciated, Thanks.

Answer Source

Can you post what the original json looks like.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download