歡迎來到Linux教程網
Linux教程網
Linux教程網
Linux教程網
Linux教程網 >> Linux編程 >> Linux編程 >> 全國省市列表的JSON數據

全國省市列表的JSON數據

日期:2017/3/1 9:35:48   编辑:Linux編程

工作需要用到JSON格式的省市列表,搜了一下沒找到合適的,就從百度的JS裡提取出來

過程很簡單,將下面的代碼保存成一個html文件,用浏覽器打開這個文件就可以看到了

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://passport.baidu.com/js/sitedata_bas.js" charset="GBK"></script>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>

<script>
$(document).ready(function(){
$("#china_cities").text(JSON.stringify(arrCity));
});
</script>

<title>中國城市列表JSON數組</title>

</head>

<body>
<p id="china_cities"></p>
</body>
</html>

--------------------------------------分割線 --------------------------------------

Struts中異步傳送XML和JSON類型的數據 http://www.linuxidc.com/Linux/2013-08/88247.htm

Linux下JSON庫的編譯及代碼測試 http://www.linuxidc.com/Linux/2013-03/81607.htm

jQuery 獲取JSON數據[$.getJSON方法] http://www.linuxidc.com/Linux/2013-03/81673.htm

用jQuery以及JSON包將表單數據轉為JSON字符串 http://www.linuxidc.com/Linux/2013-01/77560.htm

在C語言中解析JSON配置文件 http://www.linuxidc.com/Linux/2014-05/101822.htm

--------------------------------------分割線 --------------------------------------

Copyright © Linux教程網 All Rights Reserved