Where is the error, console is spitting back ID is not defined, I want the "url: id" to select a button depending on its id to return a result and display it on a div on the index
<script type="text/javascript">
jQuery(document).ready(function ($) {
$('button').click(function() {
$(this).attr("id");
switch(id) {
case 1:
id = 'Reportes/Empresas.php'
break;
case 2:
id = 'Reportes/Departamento.php'
break;
case 3:
id = 'Reportes/Empleados.php'
break;
}
$.ajax({
type: 'GET',
url: id,
data: '',
datatype: 'html',
cache: 'false',
success: function(response) {
$('div.results').append(response);
alert('Load was performed.');
},
error: function(){
alert('Nope');
}
});
alert('Fail');
}); // End onclick
});
</script>
My coworker says there are three errors, but cant help right now.