Ajax Jquery 实现

2019-04-15 13:53发布

function _submit()
{
var pic=document.getElementById("picfile").value;
$.ajax({
type: "POST",
dataType: "text",
url: "<%=request.getContextPath() %>/txl/global.do?m=checkAttach",
data: "&pic="+pic,
success: function(msg){
if(msg=="success")
{
document.forms[0].action='<%=request.getContextPath() %>/txl/global.do?m=update&deptId=<%=deptId%>&ryid=<%=ryid%>';
document.forms[0].submit();
return true;
}else
{
alert(msg);
}
}
});
}