To see jQuery asynchronous upload files why wrong, no reaction

	<script type="text/javascript" src="../js/jquery-1.4.2.min.js"></script>
	<script type="text/javascript" src="../js/ajaxfileupload.js"></script>	
<script type="text/javascript">
	$(document).ready(function(){
			$('#b1').click(function(){
				if($('#jobName').val() == ''){
					alert("The applicant cannot be empty!");
					return false;
				}
				if(confirm("If submitting?")){
				  $.ajaxFileUpload({
	                  type: "post",
	                  url: "vote_applicationSubmit.action",
	                  secureuri:false,
	                  fileElementId:'file',
	                  data:{
	                  	  jobName: $('#jobName').val(),
	                  	  jobContent: $('#jobContent').val(),
	                  	  jobOperatorNum: $('#jobOperatorNum').val(),
	                  	  jobOrgId: $('#jobOrgId').val(),
	                  	  jobTaskId: $('#jobTaskId').val(),
	                  	  orgName: $('#orgName').val()
	                  },
	                  dataType : "json", 
	                  success: function(data){
		 
                  });
				}else{
					return false;
				}
			})
		})
		

</script>

This is a page:
<form action="vote_applicationSubmit.action" id="form1" name="form1" enctype="multipart/form-data" method="POST">
	<TABLE style="MARGIN: 10px" CLASS="Table_list" border=0
		cellSpacing=0 cellPadding=0 width="98%" align=center>
 		<tr>
 			<td bgcolor="#FFFFFF">Applicant</td>
 			<td bgcolor="#FFFFFF" colspan="2"><INPUT name="jobName" id="jobName" type=text/></td>
 		</tr>
 		<tr>
 			<td bgcolor="#FFFFFF">Material Science</td>
 			<td bgcolor="#FFFFFF" colspan="2"><INPUT type="file" name="file" id="file"/></td>
 		</tr>
 		<tr>
 			<td bgcolor="#FFFFFF">Remarks</td>
 			<td bgcolor="#FFFFFF">
 				<textarea rows="3" cols="30" name="jobContent" id="jobContent"></textarea>
 			</td>
 			<td bgcolor="#FFFFFF"><INPUT type="button" value="Submit"  id="b1"/></td>
 		</tr> 		 		
 	</table>
 	<input type="hidden" name="jobOperatorNum" value="${info.officerName}" id="jobOperatorNum"/>
 	<input type="hidden" name="jobOrgId" value="${info.orgId}"  id="jobOrgId"/>
 	<input type="hidden" name="orgName" value="${info.orgName}"  id="orgName"/>
 	<input type="hidden" name="jobTaskId" value="<%=request.getParameter("jobTaskId") %>" id="jobTaskId"/>
 </form>

Action
	private File file;
	private String fileFileName;
	private String fileContentType;
	private String uploadDir;
        Omit the get and set methods, 

The struts.xml configuration
			<result name="applicationSubmit" type="json">
				 <param name="contentType">
                     text/html
                 </param>
			</result>

Try, no use, what is wrong, I want asynchronous upload files, use the ajaxFileUpload plugin

Started by Lareina at November 10, 2016 - 5:30 AM

Your page and click the submit button when, did not respond to JS events.!
You just add in form inside a action.
In the presented there plus onclick events corresponding to the above JS.

Posted by Spike at November 19, 2016 - 6:18 AM

The response to 2013-10-15 08:53:41 was removed by the administrator

Posted by Baldwin at November 30, 2016 - 6:27 AM

Should be wrong. Suggestions for step tracking, positioning the reason

Posted by Milly at December 14, 2016 - 7:27 AM

"Do not use "is what meaning, interface" if submitting "there is no alert out, in addition to struts.xml, action can be the whole point

Posted by Bartley at December 27, 2016 - 8:10 AM