I am Getting Following Error Undefined index: userLoggedIn in C:\xampp\htdocs\HamdardSocial\includes\handler\ajax_load_posts.php AJAX Code to Fetch data from ajax_load_posts.php
<script>
var userLoggedIn = '<?php echo $userLoggedIn; ?>';
$(document).ready(function() {
$('#loading').show();
//Original ajax request for loading first posts
$.ajax({
url: "includes/handler/ajax_load_posts.php",
type: "POST",
data: "page=1&userLoggedIn=" + userLoggedIn,
cache:false,
success: function(data) {
$('#loading').hide();
$('.posts_area').html(data);
}
});
});
</script>`
I have also tried using POST and REQUEST method but no success Code of ajax_load_posts.php
<?php
include ('../../config/config.php') ;
include ('../classes/User.php') ;
include ('../classes/Post.php') ;
$limit=10;
$posts = new Post($conn, $_POST['userLoggedIn']);
$posts->loadPostsFriends();
?>