Forked from anonymous/validar_formulario_upload.js
Last active
February 14, 2017 15:40
-
-
Save cesjam7/aa96e1fd60ce7757efdf1e366638de71 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
$(document).ready(function() { | |
$(".submit_btn_enviar").click(function(evt) { | |
evt.preventDefault(); | |
var postid = $(this).attr('data'); | |
var id = jQuery("#idpost-" + postid).val(); | |
alert(id); | |
// declaro la variable formData e instancio el objeto nativo de javascript new FormData | |
var formData = new FormData(document.getElementById("frmSubir_"+id)); | |
// declaro la variable ruta | |
var ruta = '/wp-content/themes/acosa/enviar_cv.php'; | |
// iniciar el ajax | |
$.ajax({ | |
url: ruta, | |
// el metodo para enviar los datos es POST | |
type: "POST", | |
// colocamos la variable formData para el envio de la imagen | |
data: formData, | |
contentType: false, | |
processData: false, | |
beforeSend: function() | |
{ | |
$('#contact_results_'+id+'').prepend('<img src="/wp-content/themes/acosa/ajax-loader.gif" />'); | |
}, | |
success: function(data) | |
{ | |
$('#contact_results_'+id+'').fadeOut("fast",function(){ | |
$('#contact_results_'+id+'').html(data); | |
}); | |
$('#contact_results_'+id+'').fadeIn("slow"); | |
} | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment