javascript - php output display on a greybox -


i have form calls php script on submit insert data mysql database. output of php script return greybox. haven't been able make work appreciate guys can provide.

i have greybox call on form definition see below not doing trick.

here subset of code:

<script type="text/javascript" src="greybox/ajs.js"></script> <script type="text/javascript" src="greybox/ajx_fx.js"></script> <script type="text/javascript" src="greybox/gb_scripts.js"></script>  <div id="content">  <form id="contact_us" name="contact_us" action="contact-greybox.php"  method="post" onsubmit="return gb_showcenter('testing', this.action, 500, 500)"> <fieldset> <label for="employee_id">employee id:</label> <input id="employee_id" name="employee_id" type="number" size="10" /><p /> <label for="employee_name">employee name:<strong><br /> (as should appear on email) </strong></label> <input id="employee_name" name="employee_name" type="text"  /><p /> </fieldlist>  <p class="submit"><input type="image" name="submit" value="submit form" src="icons/ambas_submit.jpg" boder="0">  </form> </div> 

the php simple insert statement mysql.

appreciate help

greybox doesn't support post submits, general pattern use ajax submit form- otherwise page refresh.

you need set onclick( $.submit ) form input return false @ end of ajax call:

$('#contact_us').submit(function(){     //get inputs here     var e_id = $.('#employee_id').val();     //...etc....     $.post( ...         //set data/input fields here:         data: { id: e_id },         success: function(response){             //display response: from: contact-greybox.php            }     })     return false; }); 

fancybox overlay box supports being called pure html parameter, can put in success function:

$.fancybox(response); ...or $.fancybox(response.html)... etc. 

Comments

Popular posts from this blog

linux - Mailx and Gmail nss config dir -

c# - Is it possible to remove an existing registration from Autofac container builder? -

php - Mysql PK and FK char(36) vs int(10) -