Reputation: 1228
I am using a form to allow file download and to store the number of downloads but now I can't seem to find a way to fadeIn
a subscribe div (#cover) on form success..
This is my 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 a jquery way of doing this?
This is what I tried:
$("#free-download").bind('ajax:complete', function() {
$('#cover').fadeIn(600);
$('body').addClass('hidescroll');
});
By changing the form action to <?php echo $_SERVER['PHP_SELF']; ?>
and adding the following (below) I managed to add an echo to the page
on form success, but how do I have the #cover div fadeIn?
<?php
if(isset($_POST['clicks']))
{
echo "<p class='section-desc'>You just downloaded it</p>";
}
?>
Upvotes: 1
Views: 312
Reputation: 1228
Use php to echo a script tag containing whatever you want to achieve on submit success (in my case, a div fadeIn).
<?php
if(isset($_POST['clicks']))
{
echo '
<script type="text/javascript">
$(function() {
$( "#cover").fadeIn();
});
</script>';
}
?>
Upvotes: 1