Created
June 8, 2020 07:04
-
-
Save raihan-uddin/6e4b85162855a0e1ba255826483dce85 to your computer and use it in GitHub Desktop.
jquery file upload
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function ($) { | |
$("#btnPurchase").click(function (event) { | |
event.preventDefault(); // stopping submitting | |
var formData = new FormData($('form')[0]); | |
var data = $("#Purchaseasset").serializeArray(); | |
var url = $("#Purchaseasset").attr('action'); | |
$.ajax({ | |
url: url, | |
type: 'post', | |
data: formData, | |
processData: false, | |
contentType: false, | |
}).done(function (response) { | |
console.log(response); | |
if (response.data.success == true) { | |
runModal(response.data.message); | |
resetForm(); | |
removeCart(); | |
vals = []; | |
} | |
}) | |
.fail(function () { | |
console.log("error"); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment