1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53
| var Charts = {
load: function(params){
console.info("*** Load chart");
console.log("Charts params: ",params);
$.mobile.loading( "show");
if(params==0 || params==undefined || params==null){
params="station=1";
}
// params peut contenir station=1, ou plus de paramètre comme
// &station=1&date-from=2021-03-09&date-to=
//const st_id = new URL(params);
//console.log("Const;", st_id.searchParams.get('station'));
//ici je veux récupérer l'ID de la station pour mettre un checked dans un select.
// L'ID de la station passé en parametre, dans mon select, l'option qui a la valaur de l'ID doit être checked
return $.ajax({
url: 'https://bud.eco-sensors.ch/api/get_measures_new.php',
type: 'POST',
//data: station,
data:'y-axis-0=5&y-axis-1=2&'+params,
//data:'type[]=2&'+station, // data: { pond: pond, from: from, to: to },
cache: false,
dataType: 'json',
// xhr For testing
xhr: function () {
var xhr = $.ajaxSettings.xhr();
xhr.onprogress = function e() {
// For downloads
if (e.lengthComputable) {
console.log("Download ", e.loaded / e.total);
}
};
xhr.upload.onprogress = function (e) {
// For uploads
if (e.lengthComputable) {
//$("#field").find('#container-station-' + item).children('.chartLoading').show(1);
}
};
return xhr;
},
//... suite du code...
} |
Partager