简体   繁体   English

RestFul PhoneGap和RestFul Web服务

[英]RestFul PhoneGap and RestFul webservices

How to connect restful Web Services + phone gap. 如何连接宁静的Web服务+电话差距。 please give and sample demo. 请给和示例演示。

Try this sample 试试这个样本

$.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);
    }
});
$.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;
      });
    });

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM