<!DOCTYPE html>
<html>
<head>
<meta charset="EUC-KR">
<title>Insert title here</title>
<script type="text/javascript">
function doubleAction() {
var time = new Date().getTime();
document.boardUploadForm.action = "../ImageUpload/uploadProcess.jsp?time="
+ time;
document.boardUploadForm.submit();
document.boardWriteForm.action = "boardProcess.jsp?time=" + time;
document.boardWriteForm.submit();
}
</script>
</head>
<body>
<form name="boardWriteForm" method="post">
<input type="hidden" name="mode" value="W" />
<table border="1" summary="BoardWrite">
<caption>BoardWrite</caption>
<colgroup>
<col width="100" />
<col width="500" />
</colgroup>
<tbody>
<tr>
<th align="center">Subject</th>
<td><input type="text" name="subject" size="80"
maxlength="100" /></td>
</tr>
<tr>
<td colspan="2"><textarea name="contents" cols="80" rows="10"></textarea>
<script>
CKEDITOR.replace('contents');
</script></td>
</tr>
</tbody>
</table>
</form>
<form name="boardUploadForm" method="post"
enctype="multipart/form-data">
<table border="1" summary="upload">
<caption>upload</caption>
<colgroup>
<col width="100" />
<col width="500" />
</colgroup>
<tbody>
<tr>
<th align="center">upload</th>
<td><input type="file" multiple="multiple" id="filename"
name="filename" /></td>
</tr>
</tbody>
</table>
<p>
<input type="submit" value="write" onclick="doubleAction();" />
</p>
</form>
</body>
此来源是包含电路板写入和上传文件的wegpage
第一个form boardWirteForm用于写内容
第二个表单boardUploadForm用于上传文件
和提交按钮是触发函数doubleAction()
但只有一个提交是工作,其他提交不起作用
任何建议?
答案 0 :(得分:0)
您可以使用Ajax在您调用的同一函数中实现。
设置您自己的数据字符串并将其传递给您需要POST的每个文件
如果您要上传文件,我建议您使用jQuery Form Plugin。
function mySubmit(){
// Post 1
$.ajax({
type: "POST",
url: "post1.php",
datatype: "text",
success: function(data){
$("#result").html(data);
},
});
// Post 2
$.ajax({
type: "POST",
url: "post2.php",
datatype: "text",
success: function(data){
$("#result2").html(data);
},
});
}