The point is that i like to refresh the full page content when the value of a list changes.
<script type="text/javascript">
$(document).ready(function () {
$('#id_municipio').change(function () {
var $co_estado = null;
var $co_municipio = null;
$co_estado = $("#id_estado").val();
$co_municipio= $("#ix_municipio").val();
abrirPagDinamica('recomendaciones?co_estado='+$co_estado+'&co_municipio='+$co_municipio,'inicio','post');
});
});
</script>
The procedure
abrirPagDinamica is a js function that invokes a code igniter controller and place the result inside the id (second parameter div).
function
abrirPagDinamica(pagina, div, tipoenvio)
{
var division = pagina.split("?");
var parametros = "";
if(division.length == 2)
{
pagina = division[0];
parametros = division[1];
}
//alert(parametros);
if(tipoenvio.toLowerCase() == "post")
{
$.post(pagina,parametros,
function(rt){
$("#"+div).html(rt);
}, "text");
}else if(tipoenvio.toLowerCase() == "get")
{
$.get(pagina,parametros,
function(rt){
$("#"+div).html(rt);
}, "text");
}
}
The final result is that everything is ok: The page is updated correctly but stay with the message "loading...." and disabled.