jQuery upload de imagens

$("#edit-profile").submit(function(e){ e.preventDefault(); var formObj = $(this); var formURL = formObj.attr("action"); var formData = new FormData(this); $.ajax({ url: formURL, type: 'POST', data: formData, dataType: 'json', mimeType: "multipart/form-data", contentType: false, cache: false, processData: false, success: function(data, textStatus, jqXHR){ $.growl.notice({ title: "Sucesso", message: "Perfil alterado com sucesso." }); $('.editar-perfil button').hide(); $('.profile-name .name').text($('#nome').val()); if(data.url !== ''){ $('.profile-pic img').attr('src', data.url); } }, error: function(jqXHR, textStatus, errorThrown){ } }); return false; });

Be the first to comment

You can use [html][/html], [css][/css], [php][/php] and more to embed the code. Urls are automatically hyperlinked. Line breaks and paragraphs are automatically generated.