JS Function for MySQL Data Retrieval
Budget: $10 – $30 USD
Post Autofill Function:
Hi there i have a JS function that is not pulling the data from mysql backend and displaying it on my HTML page.
$( document ).ready(function() {
console.log( "ready!" );
$(function(){
setInterval(customfunction27, 1000);
});
function customfunction27() {
;
nombre1 = $('#nombre1').val();
apellido1 = $('#apellido1').val();
if(nombre1 != '' && apellido1 != ''){
$.post('./getCount15.php',{'nombre':nombre1,'apellido':apellido1},function (data) {
$('#theCount15').html(data);
})
}
}
});
Calls :
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$sql = $conn->prepare('select departamento from registros4 where nombre=? and apellido=?');
$sql->bind_param("sss", $nombre, $apellido1);
$sql->execute();
$sql->bind_result($total);
$sql->fetch();
$sql->close();
echo $total;
?>
Should display result here :
<p style="color:black">Ascorcenter: <span id="theCount15"></span> </p>
Hi there i have a JS function that is not pulling the data from mysql backend and displaying it on my HTML page.
$( document ).ready(function() {
console.log( "ready!" );
$(function(){
setInterval(customfunction27, 1000);
});
function customfunction27() {
;
nombre1 = $('#nombre1').val();
apellido1 = $('#apellido1').val();
if(nombre1 != '' && apellido1 != ''){
$.post('./getCount15.php',{'nombre':nombre1,'apellido':apellido1},function (data) {
$('#theCount15').html(data);
})
}
}
});
Calls :
$conn = new mysqli($servername, $username, $password, $dbname);
// Check connection
if ($conn->connect_error) {
die("Connection failed: " . $conn->connect_error);
}
$nombre = $_POST['nombre'];
$apellido = $_POST['apellido'];
$sql = $conn->prepare('select departamento from registros4 where nombre=? and apellido=?');
$sql->bind_param("sss", $nombre, $apellido1);
$sql->execute();
$sql->bind_result($total);
$sql->fetch();
$sql->close();
echo $total;
?>
Should display result here :
<p style="color:black">Ascorcenter: <span id="theCount15"></span> </p>