Skip to content

Instantly share code, notes, and snippets.

Created February 14, 2017 15:11
Show Gist options
  • Save anonymous/d35571e173a74e7fab72e8fbaf01c780 to your computer and use it in GitHub Desktop.
Save anonymous/d35571e173a74e7fab72e8fbaf01c780 to your computer and use it in GitHub Desktop.
$(document).ready(function() {
$(".submit_btn_enviar").click(function(evt) {
evt.preventDefault();
var id = jQuery("input[name=idx]").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