C# 对话框中的提交按钮问题(MVC4)
无论如何,提交按钮在我的对话框中都不起作用。一点也不 不仅使用我自己的代码,而且在一个简单的示例中:C# 对话框中的提交按钮问题(MVC4),c#,javascript,jquery,asp.net-mvc-4,C#,Javascript,Jquery,Asp.net Mvc 4,无论如何,提交按钮在我的对话框中都不起作用。一点也不 不仅使用我自己的代码,而且在一个简单的示例中: <div id="dialog"> Your non-modal dialog <input style="font-size: 0.9em; color: #ff6a00; width: 100px" type="submit" name="filter2" value="Filter" /> </div> <script type=
<div id="dialog">
Your non-modal dialog
<input style="font-size: 0.9em; color: #ff6a00; width: 100px" type="submit" name="filter2" value="Filter" />
</div>
<script type="text/javascript">
$('#open').click(function () {
$('#dialog').dialog('open');
});
$(document).ready(function () {
$("#dialog").dialog({
autoOpen: false,
modal: true,
open: function () {
jQuery('.ui-widget-overlay').bind('click', function () {
jQuery('#dialog').dialog('close');
})
}
});
});
</script>
完全没有反应。在HomeController中不调用任何内容。即使是提琴手也不会对这个提交按钮做出任何反应
我不能得到它,我错过了什么?首先,我认为这是jQuert对剑道主题的奇怪反应,但这似乎不对
编辑:
事实上,我已经问过类似的问题,但我使用了div:
提交按钮有时会在对话框内产生问题,您可以尝试使用Jquery触发提交按钮,如下所示: $'input[type=submit]'。触发'click' 只需在对话框中放置一个表单标记,如下所示 或
为什么$“打开”。单击。。外面的文件准备好了吗?应该在里面你的表格在哪?很可能jQueryUI是在它之外创建对话框的。首先,HomeController在哪里,为什么这与此有关?我想你会希望一致地使用$,而不是混合使用$,而jQueryEven fiddler根本不会对这个提交按钮做出反应…..以及为什么这会反应你根本没有提交的开放id。我认为开放按钮是在你编写脚本之后出现的..让这个脚本成为你的最后一件事html@downvoter我脑子里怎么了回答???不知道谁投了反对票但是。。。这个东西,应该放在哪里?如果它放在$document.readyfunction中{-它开始不停地调用它。只需在对话框中包装一个表单,然后用我的代码重定向到您将在表单标记中给出的任何操作。仍然没有得到它。对不起,我是一个新手,正在谈论jQuery和MVC本身,所以我的问题可能听起来很愚蠢。将Html.BeginForm放在对话框div中可以很好地工作很明显,@KartikeyaKhosla你的ans节省了我的时间:
<div id="dialog">
<form action="// where you want to post form //" method="post">
....
....
<input style="font-size: 0.9em; color: #ff6a00; width: 100px" type="submit" name="filter2" value="Filter" />
</form>
</div>
<script type="text/javascript">
$('#open').click(function () {
$('#dialog').dialog('open');
});
$(document).ready(function () {
$("#dialog").dialog({
autoOpen: false,
modal: true,
open: function () {
jQuery('.ui-widget-overlay').bind('click', function () {
jQuery('#dialog').dialog('close');
})
}
});
});
</script>