Ich bin neu auf HTTP-Anfrage und PHP. Ich habe einen http:Abrufen von Daten von einer Variablen durch HTTP-Anfrage
xmlhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
var doc = xmlhttp.response;
myFunc(doc);
}
};
xmlhttp.open("GET",some.php",true);
xmlhttp.responseType = "document";
xmlhttp.send(null);
Die PHP-Datei:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title></title>
</head>
<body id="idk">
<?php
include("include1.inc");
include_once("include2.inc");
$cxn = mysqli_connect($host,$user,$passwd,$dbname) or die("Could not connect to the server at this time.");
$table = 'table';
$data = retrieveData($table, $cxn);//selects data from mysql db return array
var_dump($data);
?>
</body>
</html>
Wie würde ich die Datenvariable erhalten, die meine Array aus meiner Datenbank hält? Wenn ich die Variable dump oder drucke, wird das Array an `responseText übergeben. Gibt es einen eloquenteren Weg, dieses Array zu erfassen?
Schriftfarbe bedeutet, dass Sie Zitate vergessen haben. – C2486
'xmlhttp.open (" GET ", some.php", wahr); '=>' xmlhttp.open ("GET", "some.php", wahr); ' – Enstage