【问题标题】:RestFul PhoneGap and RestFul webservicesRestFul PhoneGap 和 RestFul 网络服务
【发布时间】:2013-06-29 10:34:33
【问题描述】:

如何连接restful Web Services + phone gap。请提供示例演示。

【问题讨论】:

    标签: spring rest cordova phonegap-plugins restful-authentication


    【解决方案1】:

    试试这个示例

    $.ajax({
        url: Your_webservice_url,
        type: "GET",
        data: {
            ModifiedSince: modifiedSince
        },
        dataType: "json",
        success: function(data) {
            console.log("The server returned " + data.length);
            //Play with the received json data.
        },
        error: function(model, response) {
            alert("Web service error: " + response.responseText);
        }
    });
    

    【讨论】:

      【解决方案2】:
      $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?tags=cat&tagmode=any&format=json&jsoncallback=?",
          function(data){
            $.each(data.items, function(i,item){
              $("<img/>").attr("src", item.media.m).appendTo("#images");
              if ( i == 3 ) return false;
            });
          });
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多