javascript - Ajax upload PDF in iframe with jQuery -
i have problem , need help. want upload file in ajax input type file. , without reload page, show pdf under form on iframe. started :
$('#myform').on('submit.pdf-add', function(e){ e.preventdefault(); var $form = $(this); var url= $form.attr('action'); $.ajax({ type: "post", url: url, data: {}, datatype: 'json' }) .done(function(data){ if ($('input[type=file]').val().length != 0) { data_parsed = data; $('<p class="success">le pdf été uploadé avec succès !</p>').append($form); $form.append('<iframe src="'+ data_parsed +'" width="100%" height="95%"></iframe>'); $form.off('submit.pdf-add'); } else { $('<p class="fail">le pdf est inexistant !</p>').append($form); } }) .fail(function(data){ console.log(data); $("<p class='fail'>le fichier n'a pas été uploadé</p>").append($form); }); });*
i know file api improve need cross browser back upwards ! !
javascript jquery ajax iframe
No comments:
Post a Comment