Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6659185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T02:00:11+00:00 2026-05-26T02:00:11+00:00

I am having issues loading a jQuery modal window upon submit. I want a

  • 0

I am having issues loading a jQuery modal window upon submit.

I want a div to load upon submit to thank the user for entering a competition. The div opens fine if I add an a href like: <a href="#dialog" name="modal">click here"</a>

However I can’t seem to make this popup once submit. Am I doing something wrong!?

This is my form php code:

<?php
if($_POST['formSubmit'] == "Submit")
{
    $errorMessage = "";

  if(empty($_POST['formName']))
  {
    $errorMessage .= "<li>You forgot to enter your name</li>";
  }
  if(empty($_POST['formTown']))
  {
    $errorMessage .= "<li>You forgot to enter your town</li>";
  }

    $varName = $_POST['formName'];
    $varTown = $_POST['formTown'];
    $varAge = $_POST['formAge'];
    $varEmail = $_POST['formEmail'];

    $varOne = $_POST['hidden-one'];
    $varTwo = $_POST['hidden-two'];
    $varThree = $_POST['hidden-three'];
    $varFour = $_POST['hidden-four'];
    $varFive = $_POST['hidden-five'];

    if(empty($errorMessage)) 
    {
        $fs = fopen("mydata.csv","a");
        fwrite($fs,$varName . ", " . $varTown . ", " . $varAge . ", " . $varEmail . ", " . $varOne . $varTwo . $varThree . $varFour . $varFive . "\n");
        fclose($fs);

        header("Location: #dialog");
        exit;
    }
}
?>

This is the jquery code:

<script>

$(document).ready(function() {  

    //select all the a tag with name equal to modal
    $('a[name=modal]').click(function(e) {
        //Cancel the link behavior
        e.preventDefault();

        //Get the A tag
        var id = $(this).attr('href');

        //Get the screen height and width
        var maskHeight = $(document).height();
        var maskWidth = $(window).width();

        //Set heigth and width to mask to fill up the whole screen
        $('#mask').css({'width':maskWidth,'height':maskHeight});

        //transition effect     
        $('#mask').fadeIn(1000);    
        $('#mask').fadeTo("slow",0.8);  

        //Get the window height and width
        var winH = $(window).height();
        var winW = $(window).width();

        //Set the popup window to center
        $(id).css('top',  winH/2-$(id).height()/2);
        $(id).css('left', winW/2-$(id).width()/2);

        //transition effect
        $(id).fadeIn(2000); 

    });

    //if close button is clicked
    $('.window .close').click(function (e) {
        //Cancel the link behavior
        e.preventDefault();

        $('#mask').hide();
        $('.window').hide();
    });     

    //if mask is clicked
    $('#mask').click(function () {
        $(this).hide();
        $('.window').hide();
    });         

});

</script>

This is my html:

<form action="enter.php" method="post" target="_self">      
    <input class="submit" type="submit" name="formSubmit" value="Submit">
</form>


<div id="boxes">

<div id="dialog" class="window">
    <p>Modal content here</p>
</div>
</div>

</div>
</div>

<!-- Mask to cover the whole screen -->
<div id="mask"></div>
</div>
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T02:00:12+00:00Added an answer on May 26, 2026 at 2:00 am

    It sounds like you may be slightly confused as to what’s happening inbetween your web browser and your web server.

    Your web browser is running a client which renders HTML/CSS and executes JavaScript. Your browser will submit a request to the web server which executes the PHP to generate a response.

    Once your form has been submitted the request is made to the web server, which generates a response – usually another HTML page. This is where your thank you message should be.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am having issues with loading external javascript using JQuery. Every time when I
I'm having issues with google adsense and it loading before my jQuery and killing
I'm having issues with loading the user's information into Flash from a PHP script.
I am using this plugin: http://malsup.com/jquery/form/#getting-started I am having issues, getting it to submit
Following on from my earlier question , I am still having issues with loading
I'm having issues with some jQuery code I have. Using $.each I am looping
I'm having some issues with a jQuery AJAX call. My code works fine when
I'm having some issues with some javascript/jquery and a database connection. Basically I am
I'm having some issues with loading a (.properties) file from the webcontent folder in
Greetz, I am currently having issues managing a Loading screen on my mainViewController (The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.