ajax bei download raus

This commit is contained in:
Daniel Schubert 2017-03-02 22:13:56 +01:00
parent a3656f432b
commit 88f9b1bff6
2 changed files with 6 additions and 8 deletions

View File

@ -58,20 +58,14 @@ class VinylDownload {
// max count not reached
if ( false === $this->reached_max_dl( $row['count'] ) ) {
$content ='
<div id="1">
<p>Du hast noch <strong>' . ( self::MAXDOWNLOADS - $row['count'] - 1 ) .'</strong> Downloads zur Verf&uuml;gung bis der Code ung&uuml;ltig wird.
<div id="1">
<form method=POST id="dl-trigger" action="https://www.rainervonvielen.de/digital-download"><p>
<input type="hidden" value="'. $this->code . '" name="c">
<input type="hidden" value="'. $f . '" name="sel_format">
<input type="submit" class ="btn middle" value="Start">
</form>
</div>
<script>
jQuery("#dl-trigger").submit(function(e) {
jQuery("#1").html( "<p><strong>Download ist gestartet.</strong> Du hast noch <strong>' . ( self::MAXDOWNLOADS - $row['count'] - 1 ) .'</strong> Downloads zur Verf&uuml;gung bis der Code ung&uuml;ltig wird." );
});
return true;
</script>
';
}

View File

@ -5,8 +5,12 @@ jQuery(document).ready(function($) {
e.preventDefault(); // this disables the submit button so the user stays on the page
// Validation
let code = $('input[name=code]').val();
if ( code.length < 8 ) {
jQuery('#resp').html('Code ist zu kurz!');
} else {
data = {'code' : $('input[name=code]').val(),