我創建一個web應用程序,我可以使用谷歌地圖API獲得距離和運行時間..解析JSONArray jQuery中
https://maps.googleapis.com/maps/api/distancematrix/json?origins=10.964,76.007&destinations=10.982,75.999
我使用的HTTP方法,通過谷歌.. 其返回JSON作爲給定格式下面給出
{
"destination_addresses" : [ "Kanyakumari - Panvel Highway, Palathara, Kerala 676501, India" ],
"origin_addresses" : [ "Kanyakumari - Panvel Highway, Randathani, Kerala 676510, India" ],
"rows" : [
{
"elements" : [
{
"distance" : {
"text" : "2.5 km",
"value" : 2526
},
"duration" : {
"text" : "4 mins",
"value" : 228
},
"status" : "OK"
}
]
}
],
"status" : "OK"
}
我怎麼能使用jQuery提取文本的距離和持續時間文本和提醒吧..
你有什麼已經嘗試過? – haxtbh
使用'jQuery.parseJSON()'。 – mnme