json - Use of use jQuery.getJSON() for a Url -
how utilize jquery.getjson() obtain info url?
http://gbrds.gbif.org/registry/organisation/a3c228d0-3110-11db-abb8-b8a03c50a862.json?op=contacts
if result in browser, result:
[{"position":"","lastname":"","phone":"+39 06 6118286","type":"technical","city":"","country":"","isprimarycontact":true,"postalcode":"","address":"","email":"m.skofic@cgiar.org","description":"","province":"","firstname":"milko skofic","salutation":"","key":"48"},{"position":"","lastname":"","phone":"39-06-6118204","type":"administrative","city":"","country":"","isprimarycontact":true,"postalcode":"","address":"ipgri, via tre denari, 472/a, 00057, maccarese, rome, italy,","email":"eurisco@cgiar.org","description":"","province":"","firstname":"ms. sonia dias","salutation":"","key":"49"}]
take @ getjson
method on jquery documentation.
the sintaxe:
$.getjson(url, data, function success);
so, can seek this:
$.getjson("http://gbrds.gbif.org/registry/organisation/a3c228d0-3110-11db-abb8-b8a03c50a862.json?op=contacts", null, function(data) { // loop in result if array $.each(data, function(i, item) { // utilize data[i].property access each property of array. // sample: var p = data[i].position; var l = data[i].lastname; }); });
jquery json
No comments:
Post a Comment