javascript - Getting certain items with get -


sorry if title little confusing don't know how explain it.

api: http://mcping.net/api/162.223.8.210:25567

so have code goes api, , want 'variables' online, , max. how this?

code:

$.get('http://mcping.net/api/162.223.8.210:25567', function(data){         $.each(data, function(index, item){             console.log(index + "  ;  " + item)         }); }); 

try this

$.get('http://mcping.net/api/162.223.8.210:25567', function(data){     console.log(data.online);     console.log(data.max); }); 

if data javascript object, can call variables properties in snippet code.

just in case tested in fiddle http://jsfiddle.net/js18ykj1/


Comments

Popular posts from this blog

c# - Validate object ID from GET to POST -

node.js - Custom Model Validator SailsJS -

php - Find a regex to take part of Email -