简体   繁体   中英

RestFul PhoneGap and RestFul webservices

How to connect restful Web Services + phone gap. 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;
      });
    });

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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