在onsubmit之后触发Jquery事件 [英] Trigger Jquery Event after an onsubmit

查看:102
本文介绍了在onsubmit之后触发Jquery事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在表单完成操作后触发Div打开.但是我只需要根据一个特定的动作就可以做到这一点,所以它是特定的.我不确定从哪里开始.

I would like to trigger a Div to open after a form completes an action. But I need to it only happen based on one particular action so it is specific. I'm not sure where to start.

推荐答案

好,因此,如果表单完成操作(即,您已提交)后未加载新页面,则我认为您不是将用户重定向到另一个页面;您只是将最新的数据发布回当前的购物车"页面.

Ok, so if a new page is not loaded after your form completes an action (i.e. you have submitted it), I would assume you mean you're not redirecting the user to a different page; you're just posting back the current "Cart" page with the updated data.

您的问题是,如何仅在回发后才在页面上显示内容".

So your question is, "How do I display content on my page only following a postback".

虽然 jQuery可以完成所有操作,但可能不需要在这里(至少我已经正确解释了您的问题).

While jQuery does all things, it's probably not needed here (if I've interpreted your problem correctly, at least).

您只需要检查页面是第一次加载还是响应回发而加载.为此,请使用Page.IsPostBack属性:

You just need to check whether the page is being loaded for the first time or is being loaded in response to a postback. For that you use the Page.IsPostBack property:

<% if (Page.IsPostBack) { %>
   <div id="myMessage"><p>You added something to your cart.</p></div>
<% } %>

如果这不是您的意思,则需要多解释一些问题.

If this isn't what you meant, you need to explain your question a bit more.

这篇关于在onsubmit之后触发Jquery事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆