【发布时间】:2012-02-17 16:33:57
【问题描述】:
刚刚开始在 Mac 上进行 PhoneGap 开发。我有一个托管在没有分配 DNS 的服务器上的 .NET 服务。我可以使用phonegap.plist 中的IP 地址吗?我的代码可以在浏览器中运行,甚至可以作为实际 iPhone 上的网络版本运行。当我从 xcode 编译时,它似乎无法正常工作(甚至在模拟器上也没有)。我通过 lint 运行了这个 js,现在我遇到了麻烦……这就是我想要做的。
我在按钮点击时调用 GetEstimate:
function GetEstimate(From, To) {
"use strict";
varType = "GET";
varUrl = "http://xx.xxx.xxx.xx/service.svc/" +
"GetBasicEst?pickupPostalCode="+ From + "&dropoffPostalCode="+ To +"";
varContentType = "application/json; charset=utf-8";
varDataType = "jsonp";
varProcessData = true;
alert("GetEstimate");
new CallService();}
function CallService(){
alert("Inside Call Service");
"use strict";
$.ajax({
type : varType, //GET or POST or PUT or DELETE verb
url : varUrl, // Location of the service
data : varData, //Data sent to server
contentType : varContentType, // content type sent to server
dataType : varDataType, //Expected data format from server
processdata : varProcessData, //True or False
success : function(data) {//On Successfull service call
alert("Success");
var innerHtml = "";
var rhigh=data.EstimateHigh;
var rlow=data.EstimateLow;
alert(rlow);
$("#rHigh").html(rhigh);
$("#rLow").html(rlow);
$("#rHigh").formatCurrency();
$("#rLow").formatCurrency();
},
//error: ServiceFailed // When Service call fails
});}
CallService 中的警报确实触发了,然后它似乎就停在那里...不调用 $.ajax(
我可能会在左场出路,所以任何建议都会有所帮助。
【问题讨论】:
标签: cordova jquery-mobile mobile