0

I want to upload file with ajax file upload. File will be uploaded and address of this file is return by server. But data is undefined.

jquery-2.2.3.min.js and ajaxFileupload

<script type='text/javascript' src='js/jquery-2.2.3.min.js'></script>
<script type="text/javascript" src="js/ajaxfileupload.js"></script>``

<input type="file" id="upload_pic_file1" name="upload_pic_file1"/>
<input type="hidden" id="enrolment_pic1"  name="enrolment_pic1"/>

$.ajaxFileUpload({
  url: domainName +'/UploadServlet',
  secureuri: false,
  fileElementId: "upload_pic_file1",
  dataType: 'JSON',
  cache: false,
  beforeSend: function () {},
  success: function (data) {
    alert(data);//data is undefined!
$("#enrolment_pic1").val(data);
}
});

I don't know where problem is. There is no error! Server is on another IP address.

Atefeh Rashidi
  • 485
  • 1
  • 8
  • 32

0 Answers0