function objetoAjax() {
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;
}
var xhttp = objetoAjax();
function enviar(form) {
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
document.getElementById("respuesta").innerHTML = this.responseText;
} else {
document.getElementById("respuesta").innerHTML = "no enviado";
}
}
xhttp.open("POST","subir.php", true);
xhttp.send(new FormData(form));
}