Advertisement
Guest User

Untitled

a guest
Mar 27th, 2015
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.66 KB | None | 0 0
  1. {
  2. "results" : [
  3. {
  4. "address_components" : [
  5. {
  6. "long_name" : "Kolkata",
  7. "short_name" : "Kolkata",
  8. "types" : [ "locality", "political" ]
  9. },
  10. {
  11. "long_name" : "Kolkata",
  12. "short_name" : "Kolkata",
  13. "types" : [ "administrative_area_level_2", "political" ]
  14. },
  15. {
  16. "long_name" : "West Bengal",
  17. "short_name" : "WB",
  18. "types" : [ "administrative_area_level_1", "political" ]
  19. },
  20. {
  21. "long_name" : "India",
  22. "short_name" : "IN",
  23. "types" : [ "country", "political" ]
  24. }
  25. ],
  26. "formatted_address" : "Kolkata, West Bengal, India",
  27. "geometry" : {
  28. "bounds" : {
  29. "northeast" : {
  30. "lat" : 23.0078201,
  31. "lng" : 88.5428696
  32. },
  33. "southwest" : {
  34. "lat" : 22.3436288,
  35. "lng" : 88.19430439999999
  36. }
  37. },
  38. "location" : {
  39. "lat" : 22.572646,
  40. "lng" : 88.36389500000001
  41. },
  42. "location_type" : "APPROXIMATE",
  43. "viewport" : {
  44. "northeast" : {
  45. "lat" : 23.0078201,
  46. "lng" : 88.5428696
  47. },
  48. "southwest" : {
  49. "lat" : 22.3436288,
  50. "lng" : 88.19430439999999
  51. }
  52. }
  53. },
  54. "place_id" : "ChIJZ_YISduC-DkRvCxsj-Yw40M",
  55. "types" : [ "locality", "political" ]
  56. }
  57. ],
  58. "status" : "OK"
  59. }
  60.  
  61. $(function() {
  62. $("#home_city_select").change(function() {
  63. //alert( $('option:selected', this).text() );
  64. var city = document.getElementById("home_city_select").value;
  65. var ltd;
  66. var lng;
  67.  
  68. var jsonLtdLng="https://maps.googleapis.com/maps/api/geocode/json?address="+city+"&key=API_KEY";
  69. //alert(JSON.stringify(jsonLtdLng));
  70. //alert($.getJSON(jsonLtdLng));
  71. //alert($.getJSON(jsonLtdLng.lat));
  72. //alert($.getJSON(jsonLtdLng.results.geometry.location.lat));
  73. //alert($.getJSON(jsonLtdLng.results[0].geometry.location.lat));
  74. //alert($.getJSON(jsonLtdLng.results[0].geometry.location.lat()));
  75. alert(jsonLtdLng.results[0].geometry.location.lat());
  76. });
  77. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement