karthika pommudu

karthika pommudu

  • 1.6k
  • 250
  • 5.6k

How to get JSON data on ajax call every 10secs

Mar 16 2019 1:55 AM
Here is code.When i run this code it's to get the data product_id, it's showing alert undefined.but I want to get Latitude Longitude with every 10 secs update.kindly share any idea ASAP
  1. <script type="text/javascript">  
  2. startJsonSession();  
  3. function startJsonSession(){  
  4. $.ajax({  
  5. url: "next28.php",  
  6. cache: false,  
  7. dataType: "json",  
  8. complete: function(data) {  
  9. pid = data.Latitude;  
  10. alert(pid);  
  11. }  
  12. });  
  13. }  
  14. <script>  
JSON output from next28.php:
 
{"LiveDataJSon":[{"Latitude":11.712140,"Longitude":78.054493,"Speed":0.00,"PositionTime":"16/Mar/2019 11:18:18 AM","PositionType":"GPS","Direction":"East","ACC":"Off","Battery":"100%","GSMStrength":"Strong Signal","PowerStatus":"Power Connected"}]}

Answers (4)