1. 程式人生 > >form中的action,submit="return save()"以及ajax提交方法

form中的action,submit="return save()"以及ajax提交方法

con tle delete url mes bgcolor fine jquery width

<form enctype="multipart/form-data" method="post" name="formform1" id="formform1"action="" onsubmit="">
<table border="1" cellspacing="0" align="center" bgcolor="#EAEAEA" bordercolor="#EFEFEF" bordercolordark="#ffffff" style="font-size:12px;margin-top: 2px" width=1000px>
<tr height="30px">
<td align="center">
<h5 style="width:1000px;height:20px;text-align:center;margin-top:30px;margin-bottom:25px;">項目區位圖上傳</h5>
項目圖類型:<select name="pictype" id="pictype" style="margin-top:20px;">
<option value="" selected>請選擇</option>
<option value="1">域項目圖</option>
<option value="2">區域項目圖</option>
</select>&nbsp;<input type="file" id="xfile" name="xfile"style="width:450px;margin-top:20px;" onchange="CheckExt(this)">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="button" name="UploadButton" id="UploadButton" value="上傳" onclick="save()"><br>
</td>
</tr>
<tr height="20px"rowspan="1"></tr>
<tr rowspan="3">
<td align="center">
<table border="1" cellspacing="0" align="center" bgcolor="#EAEAEA" bordercolor="#EFEFEF" bordercolordark="#ffffff" style="font-size:12px;margin-top: 2px" width="1000">
<tr algin="center">
<td align="center">類別</td>
<td align="center">操作</td>
</tr>
<list picturelist as list>
<tr>
<td>
${list.TITLE}<input type="hidden" value="${list.SPID}" name="ProjectPic" id="y">
</td>
<td>
<a href="#" onclick="SeePic(‘${list.PATH}‘)"><font color="blue">預覽</font></a>&nbsp;<a href="#" onclick="deleteProjectPic(${list.SPID})"><font color="blue">刪除</font></a>
</td>
</tr>
</list>

</table>
</td>
</tr>

</table>
</form>

2.js

<script>
  function deleteProjectPic(spid){
if(confirm("是否刪除該信息?")) //彈出確認對話框
{
deletePic(spid);//點擊確定時執行刪除操作。
}
}
function deletePic(spid){
var timeOut = 1000*60*5;//5分鐘
jQuery.ajax({
mode:"",
async:false,
url:"/Business/NewHouse/DeleteProjectPicAjax.5i5j",
contentType:"application/x-www-form-urlencoded;charset=UTF-8",
data:{SPID:spid},
type:"post",
timeout:timeOut,
success:function(data){
var code="";
var message="";
var xmldoc=jQuery.parseXML(data);
jQuery(xmldoc).find("result").each(function(i)
{
code = jQuery(this).children("code").text();
message = jQuery(this).children("message").text();
});
alert(message);
window.location.href="/Business/NewHouse/NewHouseProjectCheckListView.5i5j";
},
error:function(XMLHttpRequest,textStatus,errorThrown){
if(textStatus == "timeout"){
alert("連接超時");
}
if(typeof ( loading)!="undefined"){
loading.hide();
}
}

});
}

</script>

form中的action,submit="return save()"以及ajax提交方法