How can i convert the result into a string to use it in js? I made an AJAX connection and need the number of all records.
server3.php: The result should be converted to an int.
<?php
  $antwort = $_GET['aa'];
  $con = mysqli_connect('localhost','root','','loginpage');
  if (!$con) {
  die('Could not connect: ' . mysqli_error($con));
  }
  mysqli_select_db($con,"loginpage");
  $sql="SELECT COUNT(id) AS anzahl FROM frage";
  $result = mysqli_query($con,$sql);
  $row = intval($result);
  echo "<p>" . $row . "</p>";
  mysqli_close($con);
  ?>
js.js: I tried it with this.response too.
function anzahlFragen() {
var xmlhttp2 = new XMLHttpRequest();
xmlhttp2.onreadystatechange = function() {
    if (this.readyState == 4 && this.status == 200) {
        fragenAnzahl = this.responseText;
    }
}
xmlhttp2.open("GET","server3.php",true);
xmlhttp2.send();
}
 
     
    