Revision: 17043
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at August 21, 2009 11:21 by s1nerg1a
Initial Code
function nuevoAjax(){
var xmlhttp=false;
try{
xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
}catch(e){
try {
xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
}catch(E){
xmlhttp = false;
}
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') {
xmlhttp = new XMLHttpRequest();
}
return xmlhttp;
}
function Nombre()
{
var Txt_Nombre=document.getElementById('idprueba').value;
var resul = document.getElementById('resultado');
var ajax = nuevoAjax();
ajax.open("POST", "php_server.php",true);
ajax.onreadystatechange=function() {
if (ajax.readyState==4) {
resul.innerHTML = ajax.responseText;
}
}
ajax.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
ajax.send("nombre="+Txt_Nombre);
return;
}
Initial URL
Initial Description
Crea el elemento XMLHttpRequest y llama a una funcion del lado del server. guardalo como f.js
Initial Title
ejemplo de AJAX
Initial Tags
Initial Language
JavaScript