[font=Consolas, "Courier New", monospace][font=Consolas, "Courier New", monospace]Hallo,[/font][/font]
[font=Consolas, "Courier New", monospace][font=Consolas, "Courier New", monospace]wie kann ich den [font=Consolas, "Courier New", monospace]output_json außerhalb meiner Funktion nutzen bzw. was muss ich an dieser Funktion ändern damit es klappt?[/font][/font][/font]
[font=Consolas, "Courier New", monospace][font=Consolas, "Courier New", monospace][font=Consolas, "Courier New", monospace]Vielen Dank für eure Hilfe[/font][/font][/font]
[font=Consolas, "Courier New", monospace][font=Consolas, "Courier New", monospace]wie kann ich den [font=Consolas, "Courier New", monospace]output_json außerhalb meiner Funktion nutzen bzw. was muss ich an dieser Funktion ändern damit es klappt?[/font][/font][/font]
[font=Consolas, "Courier New", monospace][font=Consolas, "Courier New", monospace][font=Consolas, "Courier New", monospace]Vielen Dank für eure Hilfe[/font][/font][/font]
Code:
lists = getContentFromPHP(1,'loadListNames_your.php')
console.log(lists)
Code:
function getContentFromPHP(param1,php_function){
const params = new FormData();
params.append('post_var', param1);
fetch(php_function, {
method: 'post',
body: params
}).then(res => {
return res.text();
}).then(res => {
output = res;
let output_json = JSON.parse(output);
console.log(output_json)
})
return output_json
}