c***@126.com
c***@126.com
  • 发布:2017-07-03 23:10
  • 更新:2017-07-04 10:23
  • 阅读:1830

mui调用ajax 调用webservice 返回数据类型 string 得到的是xml数据 如何获取到数据

分类:MUI

http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx?op=qqCheckOnline
返回的数据
<?xml version="1.0" encoding="UTF-8"?>
<string xmlns="http://WebXml.com.cn/">V</string>

如何获取数据“V”

mui调用ajax 调用webservice 返回数据类型 string
得到的是xml数据 如何获取到数据“V”

mui.post('http://www.webxml.com.cn/webservices/qqOnlineWebService.asmx/qqCheckOnline',{
qqCode:'123456712'

},function(data){  
    //怎么获取到数据求大神  

},'text');
2017-07-03 23:10 负责人:无 分享
已邀请:
LLgg

LLgg

<!DOCTYPE html>  
<html>  
    <head>  
        <meta charset="UTF-8">  
        <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />  
        <title>请求中旋网xml数据</title>  
        <script src="js/mui.min.js"></script>  
        <!--使用mui.ajax,必须调用的js文件-->  
        <!--miu.ajax-->  
        <script>  
            //调用mui.ajax函数  
            mui.init();  
            mui.ajax('1.xml', { //请求地址  
                dataType: 'xml', //服务器返回数据类型:html、json、script、text、xml  
                timeout: 15000, //超时时间设置为10秒  
                async: true, //true异步加载,false同步加载(同步加载,浏览器会被锁死,只有执行完才会执行其他的代码)  
                cache: true, //缓存  
                success: function(data) {  
                    //xml类型返回  
                    document.getElementById("myDiv").innerHTML = data.getElementsByTagName("string")[0].childNodes[0].nodeValue;  

                },  
                error: function(xhr, type, errorThrown) {  
                    //错误事件  
                }  
            });  
        </script>  
    </head>  
    <body>  
        <div id="myDiv"></div>  
        <!--xmlhttp数据返回的div-->  
    </body>  
</html>

1.xml

<?xml version="1.0" encoding="UTF-8"?>  
<zxlmweb>  
    <founder>  
        <name>  
        <string xmlns="http://www.zxlmweb.com">中旋网http://www.zxlmweb.com</string>  
        </name>  
    </founder>  
</zxlmweb>

这是我的网站,O(∩_∩)O谢谢支持----->>中旋网ZxlmWeb

该问题目前已经被锁定, 无法添加新回复