Form之action提交不刷新不跳转

<div class="file-box">
<form action="/File/fileUpLoad" id="form1" name="form1" method="post" target="id_iframe">
<input type="text" id="input_text" name="input_text"/>
<%--<input type="submit" id="sobmit" name="submit" value="提交" />--%>
<input type="button" value="提交" onclick="aa()" />
</form>

<iframe id="id_iframe" name="id_iframe" style="display:none;"></iframe>
<input type="text" value=" This is a hiden !" id="hid"/>

</div>

<script type="text/javascript">
function aa() {
// document.form1.action = '/File/fileUpLoad';
document.form1.submit();
// location.href = "/file/index";
$('#hid').hide();
// location.href = "/file/index";
}
</script>

public ActionResult Index()
{
Response.Write("<script language='javascript'>alert('页面加载');</script>");
return View();
}


public void fileUpLoad(FormCollection form)
{
string url = form["input_text"];

Response.Write("<script languge='javascript'>alert('" + url + "');</script>");


}

posted @ 2016-01-18 11:03  PrintY  阅读(3619)  评论(0编辑  收藏  举报