2013-10-05 46 views
0

我想問一些使用jquery移動調用json webservices的運行示例/教程。使用jQuery移動調用Webservice

我試圖開發我的第一個移動應用程序,但無法找到一個富有成效的例子。

謝謝

回答

0
var serviceUrl = 'http://' + _SERVER_ADDRESS + '/YOURSERVICE.svc/' + method; 
    var jsonCallbackMethod = 'spycallback49328572'; 

    $.ajax({ 
     type : "GET", 
     url : serviceUrl, 
     jsonpCallback : jsonCallbackMethod, 
     data : params, 
     dataType : 'jsonp', 
     timeout : 11*1000 // Necessary in order to detect not found(404) error 
    }) 
    .done(function(response) { <success code> }) 
    .fail(function(xhr) { <failure code> });