Sunday, 25 August 2013

Send files trough ajax post().serialize()

Send files trough ajax post().serialize()

This is a working script for send a form to a php file which process the
data. What should I modify to this code in order to send files? My form
has a file input and I want to keep this code.
Thanks in advance!
<script type="text/javascript">
$("#agregarpaquete").submit( function() {
$.post("cargar_paquete.php",$("#agregarpaquete").serialize(),function(res){
if(res == 1){
$("#exitopaquete").delay(200).fadeIn("slow"); //
Show success div
} else {
$("#fracasopaquete").delay(500).fadeIn("slow"); //
Show failure div
}
});
return false;
});
</script>

No comments:

Post a Comment