1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39
| <html>
<head><title>Example SOAP application</title>
<script src="xmlhttp.js" type="text/javascript"></script>
<script src="soapfun.js" type="text/javascript"></script>
<script src="domfun.js" type="text/javascript"></script>
</head>
<body>
<script type="text/javascript"> <--
function upd()
{
var item = document.getElementById('PlaceName').value;
var url = 'http://www.webservicex.net/WeatherForecast.asmx';
var params = {PlaceName:PlaceName};
SOAP.q_async_trans(url, 'http://www.webservicex.net', 'GetWeatherByPlaceName', params, upd_ok, upd_nok);
}
function upd_ok(data)
{
var responseblock = document.getElementById('GetWeatherByPlaceNameResponse');
var app = function(obj) { responseblock.appendChild(obj) }
dom_wipe(responseblock)
app(dom_tag_with_children('b', [dom_text('count: ')]));
app(dom_text(data.GetWeatherByPlaceNameResponse.GetWeatherByPlaceNameResult.Latitude));
}
function upd_nok(responseobject)
{
alert("Not ok");
}
--></script>
Input: <input type="text" id="item" onchange="upd()"><br>
<div id="GetWeatherByPlaceNameResponse" style="width:50%;height:100px;border:1px solid blue"></div>
</body>
</html> |
Partager