tidying up
rodzic
c698d54235
commit
2c71e152ec
22
index.php
22
index.php
|
@ -155,28 +155,41 @@ function SetSiteOther() {
|
|||
}
|
||||
|
||||
function predSub() {
|
||||
appendDebug(null, 1);
|
||||
appendDebug("Sending data to server for uuid: " + document.form1.uuid.value);
|
||||
appendDebug("Downloading GRIB data for tile, this could take some time...");
|
||||
appendDebug("Do NOT stop or refresh your browser.");
|
||||
}
|
||||
|
||||
function handlePred(pred_uuid) {
|
||||
appendDebug(null, 1);
|
||||
appendDebug("Prediction running with uuid: " + running_uuid);
|
||||
appendDebug("Prediction done for uuid: " + running_uuid);
|
||||
// now go get the prediction data from the server
|
||||
appendDebug("Getting flight path from server....");
|
||||
getCSV(pred_uuid);
|
||||
}
|
||||
|
||||
function getCSV(pred_uuid) {
|
||||
$.get("ajax.php", { "action":"getCSV", "uuid":pred_uuid }, function(data) {
|
||||
//alert(data.length);
|
||||
parseCSV(data);
|
||||
appendDebug("Got JSON response from server for flight path, parsing...");
|
||||
if (parseCSV(data) ) {
|
||||
appendDebug("Parsing function returned all OK - DONE");
|
||||
} else {
|
||||
appendDebug("The parsing function failed");
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function appendDebug(appendage) {
|
||||
function appendDebug(appendage, clear) {
|
||||
if ( clear == null ){
|
||||
var curr = $("#debuginfo").html();
|
||||
curr += "<br>" + appendage;
|
||||
$("#debuginfo").html(curr);
|
||||
} else {
|
||||
$("#debuginfo").html("");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -200,7 +213,6 @@ function initialize() {
|
|||
}
|
||||
|
||||
function parseCSV(lines) {
|
||||
alert(lines[0]);
|
||||
var path = [];
|
||||
var max_height = -10; //just any -ve number
|
||||
var max_point = null;
|
||||
|
@ -230,6 +242,8 @@ function parseCSV(lines) {
|
|||
}
|
||||
});
|
||||
|
||||
appendDebug("Flight data parsed, creating map plot...");
|
||||
|
||||
// make some nice icons
|
||||
var launch_icon = new google.maps.MarkerImage(launch_img,
|
||||
new google.maps.Size(16,16),
|
||||
|
@ -277,6 +291,8 @@ function parseCSV(lines) {
|
|||
title: 'Balloon burst (max. altitude: ' + max_height + 'm)',
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
}
|
||||
|
||||
</script>
|
||||
|
|
Ładowanie…
Reference in New Issue