javascript - Show a DIV after Page Redirect with jQuery -


I have div which is set to hide () Code> Document is ready I want this div to appear, when the inserted division appears. I also have a form that accepts the user's input on the form of his page, action = "& lt ;? php echo htmlentities ($ _ SERVER ['PHP_SELF']);? & Gt; Is redirected to . Submit has a class .submitRecord . On successful execution of the records in DB, the inserted DD is visible.

PHP code:

  if (isset ($ _ POST ['submit submit']) & Amp; $ success! = '' ) {Echo "
;); Echo "& lt; div class = 'alloc' & gt;"; Echo "& lt; p class = 'closebutton'> x "; Echo "& lt; p class = 'Allocation Success' & gt; Allocation for Mr / Mrs ABC succeeds; / p & gt;"; Echo "& lt; / div & gt;"; Echo "& lt; / div & gt;"; };

jQuery code:

  $ (document) .ready (function () {$ ('.dive,. Alloc '' (': visible') ($ '('. '') (.) ($: ".") (); $ (Document) .on ('click', '#saverecord', function () {If ($ ("$. (Document) .on ('click', '.closebutton', function () {$ ('. Alloc'). Hide (500);});});  

The form gets deposited and a string is assigned to var $ success but .alloc will not be

Depending on your title, any help would be appreciated.

you are a normal Submitting forms (no Ajax). This means that the stream of events is the same:

  • Your button is clicked;
  • Your Javascript Function Trigger It is not a page; >
  • The visitor is sent to the page where the form is submitted, even if the animation happens, the reason for the visitor's redirect Will not be able to see it;
  • The form has been processed and a new page is shown (any JavaScript onClick events have been triggered);
  • Success is added to the div page but remains hidden

There are two solutions:

  1. You submit the form using AJAX, keep everything in one page and what you want to do;
  2. You show - and hide on page-load - Success box on success page and you hide it only after a certain timeout or button, note that you have to load the page But the box does not need to be hidden because it is only added to a successful form page.

Comments

Popular posts from this blog

import - Python ImportError: No module named wmi -

Editing Python Class in Shell and SQLAlchemy -

c# - MySQL Parameterized Select Query joining tables issue -