RestFul PhoneGap和RestFul Web服务

时间:2013-07-02 06:48:54

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

如何连接宁静的Web服务+手机差距。请给出示例演示。

2 个答案:

答案 0 :(得分:0)

试试这个样本

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

答案 1 :(得分:0)

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