Guest User

Untitled

a guest
Apr 25th, 2018
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.04 KB | None | 0 0
  1. $('#form-job').submit(function(e) {
  2. e.preventDefault();
  3. console.log('aqui');
  4. var inputs = $(e.target).find('[name]').serializeArray();
  5.  
  6. var reader = new FileReader(),
  7. file = $('#resume')[0];
  8.  
  9. if (!file.files.length) {
  10. alert('no file uploaded');
  11. return false;
  12. }
  13.  
  14. var url = "http://localhost:5000/api/curriculum";
  15. reader.onload = function () {
  16. var data = reader.result,
  17. base64 = data.replace(/^[^,]*,/, '');
  18.  
  19. inputs.push({name:'resume', value: base64});
  20.  
  21. $.ajax({
  22. url: url,
  23. type: "POST",
  24. dataType: "JSON",
  25. data: inputs,
  26. success: function (response) {
  27. $(".contato-quad-formulario-right-enviar").hide()
  28. $(".contato-quad-formulario-right-enviar-sucesso").show()
  29. $(".contato-quad-formulario-right, .contato-quad-formulario-left").fadeTo("slow", 0.33);
  30. }
  31. });
  32. };
  33. reader.readAsDataURL(file.files[0]);
  34. });
Add Comment
Please, Sign In to add comment