表单方法“POST”无法在Firefox中运行 [英] Form method “POST” not working in firefox
问题描述
以下代码适用于Chrome版本47.0.2526.73,但在Firefox和IE 11上无效。任何想法为什么
HTML:
The following code works in Chrome Version 47.0.2526.73 but on Firefox and IE 11 doesn't work. Any ideea why
HTML:
<form action="@Url.Content("~/Account/LogOn/")" method="post" id="login_form">
<input type="text" id="username" name="username" placeholder="Username" value=""/>
<input type="password" id="password" name="password" placeholder="Password" value=""/>
<button id="btnLogin" class="btn btn-inverse pull-right" type="submit" onclick="OpenPage()" >Sign In</button>
</form>
JavaScript:
JavaScript:
function OpenPage() {
$('body').empty().load('../../../Content/LoaderHtml/loader.html');
return false;
}
代码必须从MVC调用ActionResult方法
只有onclick事件才能获得在Firefox和IE中解雇(在Chrome中表单也会触发Controlller的方法),如果我删除了onclick事件,那么在firefox中可以很好地工作,而且和chrome一起使用
我需要触发onclick事件并将表单发布到服务器(Chrome的行为还可以,但是我怎么能在firefox和IE中使这个工作)
编辑:
我也试过
The code must call an ActionResult method from MVC
Only the onclick event get's fired in Firefox and IE (in Chrome the form also triggers the Controlller's method), if i remove the onclick event everthing works well in firefox and ie and chrome
I need to trigger the onclick event and also to post the form to server (The Chrome behaviour is ok, but how can i make this work even in firefox and IE)
I've tried also
onclick="return OpenPage()"
并在javascript
and in javascript
return true;
感谢您的帮助!
Thanks for help!
推荐答案
(' body ')。empty()。load(' ../../../ Content / LoaderHtml /loader.html'跨度>) ;
return false ;
}
('body').empty().load('../../../Content/LoaderHtml/loader.html'); return false; }
代码必须从MVC调用ActionResult方法
只有onclick事件才能获得在Firefox和IE中解雇(在Chrome中表单也会触发Controlller的方法),如果我删除了onclick事件,那么在firefox中可以很好地工作,而且和chrome一起使用
我需要触发onclick事件并将表单发布到服务器(Chrome的行为还可以,但是我怎么能在firefox和IE中使这个工作)
编辑:
我也试过
The code must call an ActionResult method from MVC
Only the onclick event get's fired in Firefox and IE (in Chrome the form also triggers the Controlller's method), if i remove the onclick event everthing works well in firefox and ie and chrome
I need to trigger the onclick event and also to post the form to server (The Chrome behaviour is ok, but how can i make this work even in firefox and IE)
I've tried also
onclick="return OpenPage()"
并在javascript
and in javascript
return true;
感谢您的帮助!
Thanks for help!
这篇关于表单方法“POST”无法在Firefox中运行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!