日期:2014-05-17 浏览次数:22069 次
<script type="text/javascript">
$(function(){
$("#getWeather").click(function(){
var city = $("#cityName").val();
//alert(city);
var soap = '<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/"><soap:Body><getWeather xmlns="http://WebXml.com.cn/"><theCityCode>'+ city +'</theCityCode><theUserID>123</theUserID></getWeather></soap:Body></soap:Envelope>';
$.ajax({
url:'http://webservice.webxml.com.cn/WebServices/WeatherWS.asmx?op=getWeather',
type:'POST',
dataType: 'xml',
data:soap,
success:function(data){
alert('success');
},
error:function() {
alert('error');
}
});
});
});
</script>
<script type="text/javascript">
$.ajax({
url:'http://localhost:8080/test/severlet/weather',
type:'GET',
dataType: 'json',
success:function(data){
alert(data.h