
16/12/2011, 15:11
|
| | Fecha de Ingreso: febrero-2011
Mensajes: 18
Antigüedad: 14 años Puntos: 9 | |
Respuesta: readyState == 4 - AJAX te recomiendo usar jQuery para el manejo de ajax, es excelente este framework, practicamente puedes hacer de todo con el metodo $.ajax
http://api.jquery.com/jQuery.ajax/
ejemplo de como lo utilizo:
para respuestas html:
$.ajax({
async:true,
url: "archivo.php",
cache: false,
dataType: 'html',
type: 'POST',
data: 'cod=45',
success: function(http_response){
$('#elemethtml').html(http_response);
}
});
para json:
$.ajax({
async:true,
url: "causas_falla.php",
cache: false,
dataType: 'json',
type: 'POST',
data: 'cod_m='+cod_material,
success: function(data){
for(i=0; i < data.length; i++){
$('#causa_f').append('<option value="'+data[i].cod_causa+'">'+data[i].desc+'</option>');
}
}
}); |