<s:file name="excel" id="excel"/>
function saveData(){
vald();
var postData = $("#fname").serializeArray();
$("#fname")[0].reset();
$('<div class="success-tog" >Processing...</div>').prependTo('body').delay(1000);
$.ajax({type: "POST",url: "",data: postData success: sucFunc()});
Script Code
}
You can use formdata to uplaod code or any jquery file upload plugin https://stackoverflow.com/a/204271/876739
You can see this post https://stackoverflow.com/a/41458116/876739
$(document).on('click', '#upload', function(e) { e.preventDefault(); var fd = new FormData(); var file = $('#my_file')[0].files[0]; fd.append('file', file); fd.append('userId', $('#userid').val()); console.log("hi"); $.ajax({ url: 'UploadPic', data: fd, type: "POST", contentType: false, processData: false, success: function(dd) { alert("sucessfully Uploaded") } }); });
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <input type="file" id="my_file"> <input type="hidden" id="userid" /> <input type="button" id="upload" value="Upload" />
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.