Hi
Hannah,
I have to update CzmlDataSource but before that i want to remove old one on every ajax call it load new data.
How can i remove old data and load new one.
This works - viewer.dataSources.add(Cesium.CzmlDataSource.load(json));
but it also keep adding on top of that. It does not remove old CzmlDataSource.
I tried few things
viewer.entities.removeAll();
//viewer.dataSources.remove(Cesium.CzmlDataSource.load(json));
for (var i = 0; i < viewer.dataSources.length; ++i) {
var dataSource = viewer.dataSources[i];
//if (dataSource.name === "simple") {
viewer.dataSources.remove(dataSource);
// break;
// }
}
Non of them are working....
Here is my Ajax call back code -
\.ajax\(\{
url: "ajax/admin\_ajax\.php",
type: "POST",
cache: false,
data: \{
tracker\_req: "yes",
\},
dataType: 'text',
success: function \(result\)
\{
var result\_json = .parseJSON(result);
var json = ;
\.each\(result\_json\["live\_flights"\], function\( index, value \) \{
json = value;
\}\);
//console\.table\(json\);
var json\_empty = \[\];
("#count_total_flights").html(result_json["live_flights_count"]);
$("#logged_in_operator").html(operator_icao_code);
viewer.dataSources.add(Cesium.CzmlDataSource.load(json));
}
});
Thanks