在onsubmit之后触发Jquery事件

编程入门 行业动态 更新时间:2024-10-24 04:39:48
本文介绍了在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事件

本文发布于:2023-10-27 00:11:02,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1531749.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:事件   onsubmit   Jquery

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!