Ка из JSON получить данные с js
Ка из данного JSON получить title как параметр с помощью js, спс за ответы
$(function() { //Activ'Map plugin init $('#activmap-wrapper').activmap({ places: [ { title: 'Gorki Street Area', address: '', phone: '', url:'https://visitgyumri.buildatourapp.com/gyumri-gorki-street/', tags: ['gorki'], lat: 40.787520, lng: 43.858581, img: 'stops/stop1/stop1railwaystation.jpg', icon: 'images/1.png' }, { title: 'Central Sqaure Area', address: '', phone: '', url:'https://visitgyumri.buildatourapp.com/gyumri-citysquare/', tags: ['downtown'], lat: 40.785227, lng: 43.841713, img: 'stops/stop2/stop2vardanantssquare.jpg', icon: 'images/2.png' },],}); |
Цитата:
Это обычный объект. Цитата:
<!DOCTYPE html> <html> <head> <meta http-equiv='Content-Type' content='text/html; charset=windows-1251' /> <script src='http://code.jquery.com/jquery-latest.js'></script> <!-- <script src="https://code.angularjs.org/1.3.9/angular.min.js"></script> <script src="https://code.angularjs.org/1.3.9/angular-route.js"></script> --> <style type='text/css'> </style> <script type='text/javascript'> $(function() { var o={ places: [ { title: 'Gorki Street Area', address: '', phone: '', url:'https://visitgyumri.buildatourapp.com/gyumri-gorki-street/', tags: ['gorki'], lat: 40.787520, lng: 43.858581, img: 'stops/stop1/stop1railwaystation.jpg', icon: 'images/1.png' }, { title: 'Central Sqaure Area', address: '', phone: '', url:'https://visitgyumri.buildatourapp.com/gyumri-citysquare/', tags: ['downtown'], lat: 40.785227, lng: 43.841713, img: 'stops/stop2/stop2vardanantssquare.jpg', icon: 'images/2.png' } ] }; for (var i=0; i<o.places.length; i++) { alert(o.places[i].title); }; // Activ'Map plugin init // $('#activmap-wrapper').activmap(o); }); </script> </head> <body> </body> </html> |
Часовой пояс GMT +3, время: 16:47. |