Here,I want to get (loop)the number of Latitude & Longitude from response to var data,data1.
Help me to solve this ...
{"Last30PointsDataJSon":[{"Latitude":11.766470,"Longitude":77.884158,"Speed":11.00,"PositionTime":"16/Mar/2019 04:32:32 PM","PositionType":"GPS","Direction":"NorthWest","ACC":"Off","Battery":"100%","GSMStrength":"Strong Signal","PowerStatus":"Power Connected"},{"Latitude":11.766087,"Longitude":77.884393,"Speed":35.00,"PositionTime":"16/Mar/2019 04:32:22 PM","PositionType":"GPS","Direction":"NorthWest","ACC":"Off","Battery":"100%","GSMStrength":"Strong Signal","PowerStatus":"Power Connected"},{"Latitude":11.765148,"Longitude":77.884998,"Speed":45.00,"PositionTime":"16/Mar/2019 04:32:12 PM","PositionType":"GPS","Direction":"NorthWest","ACC":"Off","Battery":"100%","GSMStrength":"Strong Signal","PowerStatus":"Power Connected"}]}
- var txt = '<?php echo $response;?>'
- var parser, xmlDoc;
- parser = new DOMParser();
- xmlDoc = parser.parseFromString(txt,"text/xml");
- var data = xmlDoc.getElementsByTagName("Latitude")[0].childNodes[0].nodeValue;
- var data1 = xmlDoc.getElementsByTagName("Longitude")[0].childNodes[0].nodeValue;
- console.log(data,',',data1);
- var locations=[
- [data,data1]
- ];
..............................................................