2021-05-28 14:21:10 +02:00
|
|
|
/**
|
|
|
|
* Práctica - Sistemas Web | Grupo D
|
|
|
|
* CompluCine - FDI-cines
|
|
|
|
*/
|
|
|
|
|
2021-05-27 18:01:24 +02:00
|
|
|
// Método 1: recargar la página y enviar un GET.
|
|
|
|
window.onload = function(){
|
|
|
|
var select = document.getElementById("select_cinema");
|
|
|
|
select.onchange = function(){
|
|
|
|
location.href += "&cinema=" + $('select[id=cinemas]').val();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-05-31 12:05:22 +02:00
|
|
|
var select_ = document.getElementById("select_film");
|
|
|
|
select_.onchange = function(){
|
|
|
|
location.href += "&film=" + $('select[id=films]').val();
|
|
|
|
}
|
|
|
|
|
2021-05-28 14:21:10 +02:00
|
|
|
// Método 2: enviar una petición AJAX con POST. ==> (NO FUNCIONA, PERO LA IDEA ERA HACERLO ASÍ PARA EVITAR REFRESCAR LA PÁGINA Y LLENAR LA URL)
|
2021-05-27 18:01:24 +02:00
|
|
|
/*
|
|
|
|
$(document).ready(function(){
|
2021-05-31 12:05:22 +02:00
|
|
|
$("#select_cinema").change(function(){
|
2021-05-27 18:01:24 +02:00
|
|
|
var cinema = $('select[id=cinemas]').val();
|
|
|
|
//console.log($('select[id=cinemas]').val());
|
2021-05-31 12:05:22 +02:00
|
|
|
|
2021-05-27 18:01:24 +02:00
|
|
|
$.ajax({
|
2021-05-31 12:05:22 +02:00
|
|
|
url : "index.php",
|
|
|
|
type : "post",
|
|
|
|
dataType : "html",
|
|
|
|
data : "",
|
|
|
|
success: function(response){
|
|
|
|
$("#cinemas > option[value="+ cinema +"]").attr("selected", true);
|
2021-05-27 18:01:24 +02:00
|
|
|
console.log(cinema);
|
|
|
|
},
|
2021-05-31 12:05:22 +02:00
|
|
|
error: function(response){
|
2021-05-27 18:01:24 +02:00
|
|
|
console.log(response + ' ==> Error al seleccionar el cine')
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
*/
|