在HTML页面中调用Web服务. [英] Call webservice in Html Page.

查看:371
本文介绍了在HTML页面中调用Web服务.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我必须从html调用网络服务.我尝试了这段代码,但是在Mozilla,crome中不起作用.这段代码在IE中运行良好.谁能告诉我问题出在哪里.提前谢谢.

I have to call webservice from html. I tried this code but it is not working in Mozilla,crome. this code is working good in IE. Can any one tell me where is the issue. Thanks in advance.

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <title></title>
    <script src="jquery-1.4.1.js" type="text/javascript"></script>
     <script language="JavaScript">

      var iCallID;
            function InitializeService()
            {
                service.useService("http://www.webservicex.net/CurrencyConvertor.asmx?WSDL",  "ConversionRate");
                service.ConversionRateService.callService("ConversionRate", "AFA", "INR");
            }

            function ShowResult()
            {
               alert(event.result.value);
            }


    </script>
</head>
<body onload="InitializeService()"  id="service" style="behavior:url(webservice.htc)"  onresult="ShowResult()">
    <button onclick="GetAge()">Get Age</button><br />
</body>
</html>

推荐答案

我将使用jQuery的.ajax调用, http://api.jquery.com/jQuery.ajax/ [ ^ ]这是我的偏好.
I would use jQuery''s .ajax call, http://api.jquery.com/jQuery.ajax/[^] That is my preference.


感谢我通过创建js文件解决了该问题.我创建了服务器上的js文件,并在HTML页面中调用了这些js文件的功能...
Thanks i solved it by creating js file. i created the js file which is on my server and call the function of these js file in HTML page...


这篇关于在HTML页面中调用Web服务.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆