<!doctype html>
<html lang="en">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
<link rel="stylesheet" href="studio_style.css">
<title>Buscador</title>
</head>
<body>
<div class="container-fluid">
<header class="content__title">
<h1 class="text-center">Representar valores</h1>
<h6 class="text-center">Ejercicio La web del programador</h6>
</header>
<div class="row text-center">
<div class="col">
<button type="button" style="margin-top: 20px;" class="btn btn-primary" id="buscar">Leer DB</button>
</div>
</div>
<div class="row">
<div class="col" id="respuesta">
Resultado...
</div>
</div>
</div><!-- FIN DIV CONTAINER-FLUID-->
<!-- Optional JavaScript -->
<!-- jQuery first, then Popper.js, then Bootstrap JS -->
<!--<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>-->
<script src="https://code.jquery.com/jquery-3.4.1.js" integrity="sha256-WpOohJOqMqqyKL9FccASB9O0KwACQJpFTUBLTYOVvVU=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js" integrity="sha256-T0Vest3yCU7pafRw9r+settMBX6JkKN06dqBnpQ8d30=" crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>
<script type="text/javascript">
$("#buscar").click(function(){
buscar();
});
function buscar(){
$.ajax({ //Inicio del Ajax
contentType: "application/x-www-form-urlencoded",
type: "POST",
url: "services.php",
data: ({
option: 'search_db'
}),
dataType: "json",
success: function(r) {
if(r.info != ''){
$("#respuesta").html(r.info);
}else{
alert('No existe data!');
}
}
});//Fin del Ajax
}
</script>
</body>
</html>