使用 jQuery 或 Javascript 提交表单**并刷新页面**
以下代码更改网格控件的配置,但此重新配置仅在页面刷新发生后发生。
如何自动让用户单击提交按钮? 我看到的所有 jQuery 示例都涉及 AJAX,但由于我处于需要刷新页面的独特情况,似乎没有人有示例可用的
<% using (Html.Configurator("The grid should...")
.PostTo("Details", "TLSWorkflow")
.Begin())
{ %>
<ul>
<li><%= Html.CheckBox("grouping", false, "allow <strong>grouping</strong> of data")%></li>
<li><%= Html.CheckBox("filtering", false, "allow <strong>filtering</strong> of data")%></li>
<li><%= Html.CheckBox("paging", false, "have <strong>pages</strong> with 10 items")%></li>
<li><%= Html.CheckBox("ajax", true, "make <strong>AJAX</strong> requests")%></li>
<li><%= Html.CheckBox("scrolling", true, "show a <strong>scrollbar</strong> when there are many items")%></li>
<li><%= Html.CheckBox("sorting", true, "allow <trong>sorting</strong> of data")%></li>
<li><%= Html.CheckBox("showFooter", false, "show footer")%></li>
</ul>
<button class="t-button" type="submit">Apply</button>
<% } %>
The following code changes the configuration of a Grid control, but this reconfiguration only happens after a page refresh occurs.
How can I automate the user clicking the submit button? All the jQuery samples I see involve AJAX, but since I'm in the unique situation of needing to refresh the page, no one seems to have a sample available
<% using (Html.Configurator("The grid should...")
.PostTo("Details", "TLSWorkflow")
.Begin())
{ %>
<ul>
<li><%= Html.CheckBox("grouping", false, "allow <strong>grouping</strong> of data")%></li>
<li><%= Html.CheckBox("filtering", false, "allow <strong>filtering</strong> of data")%></li>
<li><%= Html.CheckBox("paging", false, "have <strong>pages</strong> with 10 items")%></li>
<li><%= Html.CheckBox("ajax", true, "make <strong>AJAX</strong> requests")%></li>
<li><%= Html.CheckBox("scrolling", true, "show a <strong>scrollbar</strong> when there are many items")%></li>
<li><%= Html.CheckBox("sorting", true, "allow <trong>sorting</strong> of data")%></li>
<li><%= Html.CheckBox("showFooter", false, "show footer")%></li>
</ul>
<button class="t-button" type="submit">Apply</button>
<% } %>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
(顺便说一句,你在这里的情况并不独特。)
(By the way, you're hardly in a unique situation here.)
只需为您的表单提供一个 ID 并对其调用
submit
即可:使用纯 JavaScript:
或使用 jQuery:
Just give your form an ID and call
submit
on it:In plain JavaScript:
or using jQuery: