Onclick open popup and closed on click submit form in jQuery AJAX php

Description

Onclick open form in popup and onclick form submit button and closed in jQuery AJAX form bootstrap using javascript onclick text , hiper link, button, div, heading open the popup window and onclick  submit form button closed popup window and submit the form value in database through ajax, php, javascript,

jQuery bootstrap

popup window open Bootstrap Modal and form Submit

<!------Show and hide div --->

<script type="text/javascript">

function hideIt1() {

if(document.getElementById) { document.getElementById('layer2').style.visibility='hidden';}

if(document.layers) {document.layers['layer1'].visibility='hide';} }

function showIt1() {

if(document.getElementById) {document.getElementById('layer2').style.visibility='visible';}

if(document.layers) {document.layers['layer1'].visibility='show';} }

 

</script>

<!------Show and hide div --->

<button style='top:0;' id='openform' onClick="showIt1();">Click and open form</button><br>

or

<div style='top:0;' id='openform' onClick="showIt1();">Click and open form</div>

 

<div id="layer2" style="position:absolute; left:40; top:40; width:70%; visibility:hidden; padding:0%; margin:0; background:#ececec; border: 1px solid;">

Form

<form onsubmit="hideIt1();top.location.reload();" action='popup.php' method='post'>

  <input type="text" name='somename'   id="msgcommentlist" >

<input type='submit' name="submit" id="subcomment"  ><br>

<button id="form" onClick="hideIt1();">Close without completing</button>

</form>

 

</div>