Jump to content

hiding/showing popup


jimfog

Recommended Posts

Depending on a specific value taken from the database....a popup is hidden or shown in a page.

The htlm of the popup is there but when the value is true(that comes from the db) with jquery I hide it.

That is I get the value in JS....the problem with this approach is that(in case the popup is to be hidden) on page refresh the popup appears for less that a second and then disappears.

Bad for UX.

How I could make it that when the popup is hidden does not appear at all on refresh.

Iis it better maybe to handle it server-side?

I hear opinions.

 

 

Link to comment
Share on other sites

well the code works...I did not expect to work cause I had made some assumptions--which were wrong of course...I have 2 questions though.

 

why not do this with PHP enbedded in the HTML...why resorting to JS...something like this:

 

<div  <?php echo ($schedstatus == 1) ? "style='display:none;'" : "style='display:block;'" ?> id="modal">......

I have come to understand that code in a JS file tha resides INSIDE the document on load function...runs after the HTML/document is loaded...that said the modal should be shown(my assumption) and hidden WHEN the code inside the documenton load functions runs.

Obviously I miss something but what is that?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...