android - Webservice in PhoneGap -
i newbie phonegap. m stuck. m unable result while calling webservice in phone gap. used both ajax , getjson method. getting result undefined, realdata variable undefined. feeling missing something. please guys.
here code....
function ondeviceready() { console.log("device ready111111"); alert("alert device ready"); /*var jqxhr = $ .getjson( 'http://www.infoline.in/mobdata.aspx? reqfor=area_list&city=ahmedabad', function() { console.log("device ready111111....."+jqxhr); alert('success'); }).error(function() { alert('error'); });*/ $(document).ready(function () { $.ajax({ url: "http://www.infoline.in/mobdata.aspx", data: { "reqfor": "area_list", "city": "ahmedabad" }, crossdomain: true, contenttype: "application/json; charset=utf-8", datatype: "json", success: function (msg, textstatus, jqxhr) { alert(textstatus); var therealdata = msg.d; alert(therealdata.length) } }); });
in order view object have convert msg string.
try this:
console.log(json.stringify(msg));