cordova - PhoneGap Veriables No Passing -


i writing app in phone gap cannot variables pass script using ajax post. ajax post works fine when submit “lon=51.02&lat=0.00&ap=1539”. when try , add phone gap variables “lon=” + pglon + “&lat=”+ pglat + “&ap=1539” cannot submit.

any on doing wrong great.

thank 

function onsuccess(position) {     var div = document.getelementbyid('mydiv');      div.innerhtml = 'latitude: '             + position.coords.latitude  + '<br/>' +                     'longitude: '            + position.coords.longitude + '<br/>' +                     'altitude: '             + position.coords.altitude  + '<br/>' +                     'accuracy: '             + position.coords.accuracy  + '<br/>' +                     'altitude accuracy: '    + position.coords.altitudeaccuracy  + '<br/>' +                     'heading: '              + position.coords.heading   + '<br/>' +                     'speed: '                + position.coords.speed     + '<br/>';      var pglon =  'longitude: '             + position.coords.longitude  + '';        var pflat =  'latitude: '             + position.coords.latitude  + '';          }  $.ajax({   type: "post",   cache: false,   url: "http://mywebsite.com/uppost.php",   data: "lon=" + pglon + "&lat="+ pglat + "&ap=1539" ,   datatype: "json",   success: function(data) {     alert('success: text stored in database.');   } }); 

try this

$.ajax({      type: "post",      cache: false,     url: "http://mywebsite.com/uppost.php",      data: {"lon":  pglon , "lat": pglat , "ap":1539} ,      datatype: "text",      success: function(data) {                  alert('success: text stored in database.'); },     error: function(e){             console.log(json.stringify(e));     }    }); 

Comments

Popular posts from this blog

java - Jmockit String final length method mocking Issue -

asp.net - Razor Page Hosted on IIS 6 Fails Every Morning -

c++ - wxwidget compiling on windows command prompt -