I got javascript code which use jquery to activate function with $.post. I want to send string parameter to that function, unsuccessfully.
i try this function call i saw on other post, but it didn't work $.post(SavePoint, { data });
myTimer = (function(ctx) {
$.post(getPoint).done(function(xml) {
parseXml(xml);
var lon = (parseFloat($xml.find("lon").text()) + 180) * (screen.height / 360);
var lat = (parseFloat($xml.find("lat").text()) + 90) * (screen.width / 180);
draw(ctx, rout, lat, lon);
if (recordTime <= 0 && recordTime > -0.2) {
$.post(SaveToFile);
isSaveNeeded = "false";
}
var isSaveNeeded = document.getElementById("isSaveNeeded").value;
if (isSaveNeeded == "true") {
var latS = parseFloat($xml.find("lat").text());
var lonS = parseFloat($xml.find("lon").text());
var rudderS = parseFloat($xml.find("rudder").text());
var throttleS = parseFloat($xml.find("throttle").text());
var data = latS + "," + lonS + "," + rudderS + "," + throttleS + ",";
alert(data);
$.post(SavePoint, {
data
}); //This func call doesn't work..
alert(data);
recordTime -= 0.25;
}
});
});
setInterval(function() {
myTimer(ctx);
}, 1000 / rate);
Aucun commentaire:
Enregistrer un commentaire