Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $('#form-job').submit(function(e) {
- e.preventDefault();
- console.log('aqui');
- var inputs = $(e.target).find('[name]').serializeArray();
- var reader = new FileReader(),
- file = $('#resume')[0];
- if (!file.files.length) {
- alert('no file uploaded');
- return false;
- }
- var url = "http://localhost:5000/api/curriculum";
- reader.onload = function () {
- var data = reader.result,
- base64 = data.replace(/^[^,]*,/, '');
- inputs.push({name:'resume', value: base64});
- $.ajax({
- url: url,
- type: "POST",
- dataType: "JSON",
- data: inputs,
- success: function (response) {
- $(".contato-quad-formulario-right-enviar").hide()
- $(".contato-quad-formulario-right-enviar-sucesso").show()
- $(".contato-quad-formulario-right, .contato-quad-formulario-left").fadeTo("slow", 0.33);
- }
- });
- };
- reader.readAsDataURL(file.files[0]);
- });
Add Comment
Please, Sign In to add comment