[eluser]jozeunico[/eluser]
I have this
Code:
$(document).ready(function() {
$('#id_fondo').change(function() {
$.ajax({
type:"POST",
url:CI_ROOT+"index.php/usuario/busquedasimple/getAnios",
data: "id_fondo="+$('#id_fondo').val(),
success: function(data){
$('#radioBut').html(data);
}
});
});
});
$(document).ready(function() {
$(':radio').click(function() {
alert("hello");
$.ajax({
type:"POST",
url:CI_ROOT+"index.php/usuario/busquedasimple/manda",
data: "documentos="+$('#documentos').value(),
success: function(data){
$('#col').html(data);
}
});
});
});
And it works with dropdown and get data via ajax
I want to do something similar with a radio buttons, but even when I select from the dropdown the second function doesn't show de alert neither make de ajax request:
this is the function getAnios (first ajax request)
Code:
function getAnios(){
$anios=$this->FondosModel->getAnios($_POST['id_fondo']);
echo "<td>De:".$anios['ani_inicio']." a ".$anios['ani_final']."</td>";
if($this->DocumentModel->anyDocument($_POST['id_fondo']>0)){
$attributes = array('name'=>'tipo',
'id'=>'documentos',
'value'=>1,
'checked'=>FALSE
);
echo"<td colspan='2'>".form_radio($attributes)."<label for='documentos'>Documentos</label>";
}else{
$attributes = array('name'=>'tipo',
'id'=>'documentos',
'value'=>1,
'checked'=>FALSE,
'enable'=>FALSE
);echo"<td colspan='2'>".form_radio($attributes)."<label for='documentos'>Documentos</label>";
}
if($this->FotografiasModel->anyPhoto($_POST['id_fondo']>0)){
$attributes = array('name'=>'tipo',
'id'=>'fotos',
'value'=>1,
'checked'=>FALSE
);
echo"<td colspan='2'>".form_radio($attributes)."<label for='fotos'>Fotografias</label>";
}else{
$attributes = array('name'=>'tipo',
'id'=>'fotos',
'value'=>1,
'checked'=>FALSE,
'enable'=>FALSE
);
echo"<td colspan='2'>".form_radio($attributes)."<label for='fotos'>Fotografias</label>>";
}
if($this->FotografiasModel->anyPostal($_POST['id_fondo']>0)){
$attributes = array('name'=>'tipo',
'id'=>'postales',
'value'=>1,
'checked'=>FALSE
);
echo"<td colspan='2'>".form_radio($attributes)."<label for='postales'>Postales</label></td>";
}else{
$attributes = array('name'=>'tipo',
'id'=>'postales',
'value'=>1,
'checked'=>FALSE, 'enable'=>FALSE
);
echo"<td colspan='2'>".form_radio($attributes)."<label for='postales'>Postales</label></td>";
}
}