For some reason the data skip
is not being sent through:
main.php
var skipCounter = 0;
$('#load-more-comments').click(function(){
skipCounter++;
postid = <?php echo $_GET['t']; ?>;
$.ajax({
method: 'POST',
url: 'morecomments?t='+postid+'.php',
data: {skip:skipCounter},
success: function(data){
$('.comments-main').append(data);
}
});
});
morecomments.php
$skip = mysqli_real_escape_string($conn,$_POST['skip']);
$postid = mysqli_real_escape_string($conn,$_GET['t']);
$skip
is null I believe, as when I manually set it to 1
instead of through POST data my code (beneath) works. The actual request is successful though.
What can cause this?
url
should be 'morecomments.php?t=<....>
instead of 'morecomments?t=<....>.php
Even though you have a .htaccess that removes the .php part, it is still an invalid URL and that means that the rewrite might be removing more than you want, or the server is just rejecting part of it all together.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.