<html>
<head>
<script type="text/javascript" src="jquery-1.4.1.js"></script>
<script type="text/javascript">
$(document).ready
(
function()
{
$("#chaxun").click
(
function()
{
getHangbang();
//getHelloxml();
//getH();
// getWebs();
}
);
}
);
//获取城市编码
function getWebs()
{
$.get("http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx/getDomesticCity",function(data){
//alert($(data).find('Address').text());
$(data).find('Address').each(function(){
var $Address=$(this);
var html='<option value=';
html += $Address.find('Abbreviation').text()+'>'+
$Address.find('cnCityName').text()+'';
html +='</option>'
$('#startCity').append($(html));
$('#astCity').append($(html));
});
});
}
//查询航班信息
function getHangbang()
{
var startCity = $("#startCity").val();
var astCity= $("#astCity").val();
var theDate=$("#theDate").val();
var url="http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx/getDomesticAirlinesTime";
var url=url+"?startCity="+startCity+"&lastCity="+astCity+"&theDate="+theDate+"&userID=";
$.get(url,function(data){
$('#city').empty();
//alert("hehe:"+$(data);
//alert($(data).find('AirlinesTime').text());
//遍历xml
$(data).find('AirlinesTime').each(function(){
var $AirlinesTime=$(this);
var html='<tr >';
html +='<td>'+$AirlinesTime.find('Company').text()+'</td><td>'+
$AirlinesTime.find('AirlineCode').text()+'</td><td>'
+$AirlinesTime.find('StartDrome').text()+'</td><td>'
+$AirlinesTime.find('ArriveDrome').text()+'</td><td>'
+$AirlinesTime.find('StartTime').text()+'</td><td>'
+$AirlinesTime.find('ArriveTime').text()+'</td><td>'
+$AirlinesTime.find('Mode').text()+'</td><td>'
+$AirlinesTime.find('AirlineStop').text()+'</td><td>'
+$AirlinesTime.find('Week').text()+'</td><td>'
;
html+='</tr>'
$('#city').append($(html));
});
});
//alert("hello");
//alert(textval);
}
</script>
<body onload="getWebs()">
<p >航班信息查询</p>
<p>获得航班时刻表 DataSet
输入参数:startCity = 出发城市(中文城市名称或缩写、空则默认:上海);lastCity = 抵达城市(中文城市名称或缩写、空则默认:北京);theDate = 出发日期(String 格式:yyyy-MM-dd,如:2007-07-02,空则默认当天);userID = 商业用户ID(免费用户不需要)
返回数据:DataSet,Table(0)结构为 Item(Company)航空公司、Item(AirlineCode)航班号、Item(StartDrome)出发机场、Item(ArriveDrome)到达机场、Item(StartTime)出发时间、Item(ArriveTime)到达时间、Item(Mode)机型、Item(AirlineStop)经停、Item(Week)飞行周期(星期)
http://webservice.webxml.com.cn/webservices/DomesticAirline.asmx/getDomesticAirlinesTime
</p>
<form action="#" onsubmit="">
<p>
出发城市:<select id="startCity">
</select>
</p>
<p>
抵达城市:<select id="astCity">
</select>
</p>
出发日期:<input id="theDate" name="theDate" type="text">
<input id="chaxun" type="button" value="查询" >
</form>
<table >
<thead>
<tr>
<td>航空公司</td>
<td>航班号</td>
<td>出发机场</td>
<td>到达机场</td>
<td>出发时间</td>
<td>到达时间</td>
<td>机型</td>
<td>经停</td>
<td>飞行周期</td>
</tr>
</thead>
<tbody id="city">
</tbody>
</table>
</body>
</html>
分享到:
相关推荐
http post方式请求 webservices soap协议接口
包括服务端服务器的搭建、websevices服务端、客户端的开发及调试
axis-1_4生成websevices客户端下载cmd输入就能生成 很方便 可以参考我的同名博客。
根据城市名获取天气预报,用EXCEL导出
java web service 教程java web service 教程java web service 教程java web service 教程java web service 教程java web service 教程java web service 教程java web service 教程java web service 教程java web ...
web service教程
HTTP接口和WebService接口
Web Services平台架构,java平台上开发web services