Trigger Jquery Event after an onsubmit

回眸只為那壹抹淺笑 提交于 2019-12-13 04:44:05

问题


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.


回答1:


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".

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

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.



来源:https://stackoverflow.com/questions/4550541/trigger-jquery-event-after-an-onsubmit

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!