jquery ajax肥皂电话,无法得到回复?

时间:2013-05-29 02:21:18

标签: jquery jquery-mobile soap

请检查以下代码。任何人都可以指出我这个代码有什么问题吗? 还请建议我如何跟踪错误。

   <html>
    <head>
            <link rel="stylesheet" href="css/jquery.mobile-1.3.1.css">
            <!-- jQuery and jQuery Mobile -->
            <script src="js/jquery-1.9.1.js"></script>
            <script src="js/jquery.mobile-1.3.1.js"></script>
    <script type="text/javascript">
        var webServiceURL = 'https://www.kaiz.co.za/tunnel-web/secure/axis/kaiz';
        var soapMessage='<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><soapenv:Envelope\
        xmlns:xsd="http://www.w3.org/2001/XMLSchema"\
        xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"\
        xmlns:urn="urn:http.eli.com"\
        xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"\
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">\
        <soapenv:Body><urn:getUserDetail><emailAddress>a@abc.com</emailAddress>\
        <password>a</password></urn:getUserDetail></soapenv:Body></soapenv:Envelope>';



        function CallService()
        {
            $.ajax({
                url: webServiceURL, 
                type: "POST",
                dataType: "xml", 
                data: soapMessage, 
                contentType: "text/xml; charset=\"utf-8\"",
                processData: false,
                success: OnSuccess, 
                error: OnError
            });

            return false;
        }

        function OnSuccess(data, status)
        {
            alert(data.d);
        }

        function OnError(request, status, error)
        {
            alert('error');
        }

        $(document).ready(function() {
            jQuery.support.cors = true;
        });
    </script>

    <form method="post" action="">
        <div>
            <input type="button" value="Call Web Service" onclick="CallService(); return false;" />
        </div>
    </form>
    </head>
    </html>

0 个答案:

没有答案