how do i call a webservice using phonegap for android

前端 未结 2 608
情话喂你
情话喂你 2020-12-30 13:51

How do I make a webservice call from my phonegap app? I found two javascript libraries one from IBM and another IvanWebService http://wiki.phonegap.com/w/page/43725416/SOAP%

相关标签:
2条回答
  • 2020-12-30 14:25
    <head>
    
        <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.css" />
    <script src="http://code.jquery.com/jquery-1.4.4.min.js"></script>
    <script src="http://code.jquery.com/mobile/1.0a2/jquery.mobile-1.0a2.min.js"></script>
    
    <script type="text/javascript">
            $(function() {
    
                $("#requestXML").click(function() {
    
                         $.ajax({
                          type: "POST",
                          url: "http://YOURSITE/script.php",
                          data: "{}",
                          cache: false,
                          dataType: "xml",
                          success: onSuccess
                        });
    
                });
    
                $("#resultLog").ajaxError(function(event, request, settings, exception) {
                  $("#resultLog").html("Error Calling: " + settings.url + "<br />HTTP Code: " + request.status);
                });
    
                 function onSuccess(data)
                  {   alert(data);
                   }
    
    
            });
    
            </script>
    
    </head>
    

    Button to call the above method:

    <input id="requestXML" type="button" value="Request XML" />
    
    0 讨论(0)
  • 2020-12-30 14:40

    If it were me, I would use jQuery.

    http://www.bennadel.com/blog/1853-Posting-XML-SOAP-Requests-With-jQuery.htm http://openlandscape.net/2009/09/25/call-soap-xm-web-services-with-jquery-ajax/ http://weblogs.asp.net/jan/archive/2009/04/09/calling-the-sharepoint-web-services-with-jquery.aspx

    0 讨论(0)
提交回复
热议问题