<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
}
Asked
Active
Viewed 2,220 times
0

Andrea Ligios
- 49,480
- 26
- 114
- 243

Jani
- 1
- 1
-
2This is NOT a proper question. This is not even a question, is just a bunch of malformed (and unformatted, until my edit) code. Please edit your question, describe exactly what you want, what have you tried, what doesn't work, and the specific point where you're stuck and need help. – Andrea Ligios Dec 28 '16 at 08:15
1 Answers
1
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" />