i use the following script, and i think it needs to do the following:
When someone clicks the a href link with ID "submit" in the Form, it needs to call documentblock.inc.php and alert the data thats been echoed in documentblock.inc.php
But i get no alerts. What do i do wrong?
<form action="<?php echo $domein.'/mijnpagina/bestanden/downloaden/' ?>" method="post" name="downloaditem">
<label><input type="checkbox" id="checker_tiny" value="ja" name="blokkeer"/> Bestand blokkeren na downloaden</label>
<input name="docId" id="docId" type="hidden" value="<?php echo $fetch_bestand['id']; ?>">
<input name="downloaditem" type="hidden" value="akkoord">
<a href="#" id="submit" class="button-pink">Bestand downloaden</a>
</form>
<div class="clear"></div>
</div>
<script>
$(function () {
$('#submit').on('click', function () {
// stop form submission first
// GET VALUE OF APPID
var appid = $("#docId").val()
// GET JSON FROM PHP SCRIPT
$.ajax({
type : 'POST',
url : '/includes/documentblock.inc.php',
data: {'appid':appid},
success : function () {
alert(data);
},
error : alert('test')
});
});
});
</script>
documentblock.inc.php:
<?php echo "test"; ?>