想請問各位大大 由於
TGOS WEB API服務資訊 不能使用html frame 嵌入
我目前是需要其網站中,原始碼內依地址導出的json格式中的CODEBASE值,請問有什麼方式可以讓我依我想查詢的地址,是可以利用js取出值或有其他的好解法?
https://www.tgos.tw/TGOS_WEB_API/Sample_Codes/TGOSQueryAddr/V40/QueryAddrTGOSMap.aspx
POST 以下網址
https://www.tgos.tw/TGOS_WEB_API/Sample_Codes/TGOSQueryAddr/V40/QueryAddrTGOSMap.aspx
參數如下:
__VIEWSTATE
__VIEWSTATEGENERATOR
__EVENTVALIDATION
TxtAddress 金門縣金沙鎮光前里新興街36號
BtnQuery 查詢
可得到回覆如下:
{ "Info": [ { "IsSuccess": "True", "InAddress": "金門縣金沙鎮光前里新興街36號", "InSRS": "EPSG:3826", "InFuzzyType": "最近門牌號機制", "InFuzzyBuffer": "0", "InIsOnlyFullMatch": "False", "InIsSupportPast": "True", "InIsShowCodeBase": "True", "InIsLockCounty": "False", "InIsLockTown": "False", "InIsLockVillage": "False", "InIsLockRoadSection": "False", "InIsLockLane": "False", "InIsLockAlley": "False", "InIsLockArea": "False", "InIsSameNumber_SubNumber": "True", "InCanIgnoreVillage": "True", "InCanIgnoreNeighborhood": "True", "InReturnMaxCount": "0", "OutTotal": "1", "OutMatchType": "完全比對", "OutMatchCode": "[金門縣]\tFULL:1", "OutTraceInfo": "[金門縣]\t { 完全比對 } 找到符合的門牌地址" } ], "AddressList": [ { "PERIOD": "10008", "FULL_ADDR": "金門縣金沙鎮光前里1鄰新興街36號", "COUNTY": "金門縣", "TOWN": "金沙鎮", "VILLAGE": "光前里", "NEIGHBORHOOD": "1鄰", "ROAD": "新興街", "SECTION": "", "LANE": "", "ALLEY": "", "SUB_ALLEY": "", "TONG": "", "NUMBER": "36號", "X": -10664.441, "Y": 2710351.699, "CODEBASE": "A9202-0118-00", "CODE1": "A9202-06-011", "CODE2": "A9202-06" } ] }
用ajax啊...........如果不想學太麻煩,你也可以用js框架來做,語法簡單很多,如jQuery
$.post({
url: "https://www.tgos.tw/TGOS_WEB_API/Sample_Codes/TGOSQueryAddr/V40/QueryAddrTGOSMap.aspx",
dataType:"json",
data:{
"TxtAddress":"金門縣金沙鎮光前里新興街36號",
"BtnQuery": "查詢"
}
})
.done(function(jsondata){
console.log('這就是你要的json內容了',jsondata);
});