码迷,mamicode.com
首页 > Web开发 > 详细

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

时间:2017-05-30 13:33:14      阅读:375      评论:0      收藏:0      [点我收藏+]

标签:bottom   undefined   check   操作   ctp   cat   turn   load   err   

<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提交方法

标签:bottom   undefined   check   操作   ctp   cat   turn   load   err   

原文地址:http://www.cnblogs.com/mayay/p/6919694.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!