Just getting into the PhoneGap development on the Mac. I have a .NET service hosted on server that does not have DNS assigned. Can I use the ip address in phonegap.plist? My code works in browser and even as a web version on the actual iphone. Soon as I compile from xcode it seems to not be working (not even on emulator). I ran this js through lint and now im in a spot of bother… Here is what I am trying to do.
I call GetEstimate on button click:
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
});}
The alert inside CallService does fire then it just seems to stop there…does not call $.ajax(
I could be way out in left field so any suggestions are helpful.
I got it !! Drew: I marked you answer about the * as correct. Thank you for that. I tried a few things to get it working so I will list what I did. I changed the IP to be a dns resolving name, I took Ip out of Phonegap.plist so just the * was there. I then added a line of code to ajax call jsonp : ‘callback’. Not sure which one did it but its working now.