Код: Выделить всё
function show_results(theme=null,region=null){
var get_theme = (theme==null) ? 'tous':theme;
var get_region = (region==null) ? 'Toutes':region;
console.log("theme sent: "+get_theme+", region sent: "+get_region);
var xhr_object = new XMLHttpRequest();
xhr_object.addEventListener("readystatechange", () => {
console.log(xhr_object.readyState);
if(xhr_object.readyState === 4 && xhr_object.status === 200 && xhr_object.responseText){
formations = JSON.parse(xhr_object.responseText);
console.log(formations);
}
});
xhr_object.open("GET", window.location.origin+"/path/to/script/get_formations.php?theme="+get_theme+"®ion="+get_region);
xhr_object.send(null);
}
Код: Выделить всё
theme sent: eco-concevoir, region sent: Toutes
formations.js?v=1761056222:19 1 -> readyState as it changes
formations.js?v=1761056222:19 2
formations.js?v=1761056222:19 3
formations.js?v=1761056222:19 2
formations.js?v=1761056222:19 3
formations.js?v=1761056222:19 4
formations.js?v=1761056222:23 [{…}] -> this one is the right one with arguments
formations.js?v=1761056222:19 2
formations.js?v=1761056222:19 3
formations.js?v=1761056222:19 4
formations.js?v=1761056222:23 [{…}] -> this one is the results with get_theme=null and get_region=null
Спасибо за любую идею, как решить эту проблему...>
Подробнее здесь: https://stackoverflow.com/questions/797 ... ired-twice
Мобильная версия