today i need help with some jquery, which I really do not have much knowledge of. In the following code, where I have “variablecommentlimitneedstogehere,” how do I put the variable that I have defined as commentlimit. I have tried many different things, but have had no success. Thanks!
<input type='hidden' id='commentlimit' value='8'/>
<script>
$(window).scroll(function () {
if ($(window).scrollTop() >= $(document).height() - $(window).height()) {
document.getElementById("loadingcomments").style.display = 'block';
var commentlimit = document.getElementById('commentlimit').value;
$('#load').load('getprofilecomments.php?username=<?php echo $profilename; ?>&commentlimit=variablcommentlimitneedstogohere');
//alert('end of page');
}
});
</script>
$('#load').load('getprofilecomments.php?username=<?php echo $profilename; ?>&commentlimit=' + commentlimit);jQuery is based on javascript, so it’s the same syntax 🙂
PS If you’re using jQuery, you can do a lot of those things easier:
var commentlimit = $("#commentlimit").val();$("#loadingcomments").css("display", "block");