Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 2.53 KB  |  hits: 34  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. PhoneGap plist: Can External host be set to ip address?
  2. function GetEstimate(From, To) {
  3. "use strict";
  4. varType    = "GET";
  5. varUrl     = "http://xx.xxx.xxx.xx/service.svc/" +
  6. "GetBasicEst?pickupPostalCode="+ From + "&dropoffPostalCode="+ To +"";
  7. varContentType    = "application/json; charset=utf-8";
  8. varDataType = "jsonp";
  9. varProcessData = true;
  10. alert("GetEstimate");
  11. new CallService();}
  12.  
  13. function CallService(){
  14. alert("Inside Call Service");
  15. "use strict";
  16. $.ajax({
  17.        type          : varType, //GET or POST or PUT or DELETE verb
  18.        url           : varUrl, // Location of the service
  19.        data          : varData, //Data sent to server
  20.        contentType   : varContentType, // content type sent to server
  21.        dataType      : varDataType, //Expected data format from server
  22.        processdata   : varProcessData, //True or False
  23.        success       : function(data) {//On Successfull service call
  24.        alert("Success");
  25.        var innerHtml = "";
  26.        var rhigh=data.EstimateHigh;
  27.        var rlow=data.EstimateLow;
  28.        alert(rlow);
  29.        $("#rHigh").html(rhigh);
  30.        $("#rLow").html(rlow);                      
  31.        $("#rHigh").formatCurrency();
  32.        $("#rLow").formatCurrency();                
  33.        },
  34.        //error: ServiceFailed // When Service call fails
  35.        });}
  36.        
  37. function GetEstimate(From, To) {
  38. "use strict";
  39. varType    = "GET";
  40. varUrl     = "http://xx.xxx.xxx.xx/service.svc/GetBasicEst";
  41.  
  42. // YOUR DATA
  43. varData = "pickupPostalCode="+ From + "&dropoffPostalCode="+ To;
  44.  
  45. varContentType    = "application/json; charset=utf-8";
  46. varDataType = "jsonp";
  47. varProcessData = true;
  48. alert("GetEstimate");
  49. new CallService();}
  50.  
  51. function CallService(){
  52. alert("Inside Call Service");
  53. "use strict";
  54. $.ajax({
  55.        type          : varType, //GET or POST or PUT or DELETE verb
  56.        url           : varUrl, // Location of the service
  57.        data          : varData, //Data sent to server
  58.        contentType   : varContentType, // content type sent to server
  59.        dataType      : varDataType, //Expected data format from server
  60.        processdata   : varProcessData, //True or False
  61.        success       : function(data) {//On Successfull service call
  62.        alert("Success");
  63.        var innerHtml = "";
  64.        var rhigh=data.EstimateHigh;
  65.        var rlow=data.EstimateLow;
  66.        alert(rlow);
  67.        $("#rHigh").html(rhigh);
  68.        $("#rLow").html(rlow);                      
  69.        $("#rHigh").formatCurrency();
  70.        $("#rLow").formatCurrency();                
  71.        },
  72.        //error: ServiceFailed // When Service call fails
  73.        });}