Created
July 25, 2017 01:32
-
-
Save prinick96/abf46270369395c0c6fc3ce96df7434b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$('#idboton').click(function(e){ | |
/* START Prevención de doble clic */ | |
e.preventDefault(); | |
/* END Prevención de doble clic */ | |
var algo = new FormData(); | |
var perfil = document.getElementById('id en el input de tipo file'); | |
var file = perfil.files[0]; | |
// Hay que cargar manualmente cada input, por id | |
algo.append('nombre de campo que se recibe en php',$('#id del input').val()); | |
algo.append('perfil',file); | |
$.ajax({ | |
type : "POST", | |
url : "api/ruta", | |
contentType:false, | |
processData:false, | |
data : algo, | |
success : function(obj) { | |
console.log(obj.success); | |
console.log(obj.message); | |
}, | |
error : function() { | |
window.alert('ERROR, activar debug'); | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gracias me ha funcionado al tiro!!!