Run jQuery function via php on form submit -


i using form allow file download , store number of downloads can't seem find way fadein subscribe div (#cover) on form success..

this form:

<form action="<?php $_server['php_self']; ?>" method="post" name="free-download" id="free-download">     <button class="download" type="submit" name="clicks" onclick="window.open('download/imagins_._ro_free_files_format_icons.rar')">download (<span class="small"><?php echo getclickcount(); ?> times</span>)</button> </form> 

is there jquery way of doing this?

this tried:

$("#free-download").bind('ajax:complete', function() {           $('#cover').fadein(600);           $('body').addclass('hidescroll'); }); 

update

by changing form action <?php echo $_server['php_self']; ?> , adding following (below) managed add echo page on form success, how have #cover div fadein?

<?php if(isset($_post['clicks']))  {      echo "<p class='section-desc'>you downloaded it</p>"; } ?> 

working solution

use php echo script tag containing whatever want achieve on submit success (in case, div fadein).

<?php if(isset($_post['clicks']))  {      echo '     <script type="text/javascript">      $(function() {         $( "#cover").fadein();     });     </script>'; } ?> 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -