Below is the HTML and script to submit form using ajax (With file/ image)
HTML
Script
jQuery("form[name='uploader1']").submit(function(e) { var formData = new FormData(jQuery(this)[0]); jQuery.ajax({ url: "http://your-domain/processupload.php", type: "POST", data: formData, async: false, success: function (msg) { // alert(msg) jQuery( "#success1" ).html(msg); }, cache: false, contentType: false, processData: false }); e.preventDefault(); });
Note: Please be sure, jQuery libary has included for the page.
No comments:
Post a Comment