I am trying to create a simple Newsfeed page based on the users interest. Below I have provided my code for the same.. I just don't understand the problem here.. the thing is this same code works fine on my localhost but its not working as same on an online servers.But the $(window).scroll(function() is working perfectly and the datas are being fetch properly but the .load() function is not able to fetch the datas.
i am gettingbelow error in javascript Consol.log
XMLHttpRequest cannot load http://redirect.main-hosting.com/error404.php/26?domain=www.nizilla.tk. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://www.nizilla.tk' is therefore not allowed access.
I also tried changing the src path as src="./profile-newsfeed/jquery-1.9.1.min.js" but still i am facing the same error.
/*-------------------------------- */
<script src="http://www.nizilla.tk/profile-newsfeed/jquery-1.9.1.min.js"> </script>
<script type="text/javascript">
$(document).ready(function() {
var track_load = 0; //total loaded record group(s)
var loading = false; //to prevents multipal ajax loads
var total_groups = <?php echo $totalpage; ?>; //total record group(s)
//alert(total_groups);
if(total_groups<=0)
{
window.location='http://www.nizilla.tk/profile php/profilefollow.php';//
}
else
{
$('#container').load('http://www.nizilla.tk/profile php/userinterest.php', {'group_no':track_load}, function() {track_load++;}); //load first group
$(window).scroll(function() { //detect page scroll
if($(window).scrollTop() + $(window).height() == $(document).height()) //user scrolled to bottom of the page?
{
if(track_load <= total_groups && loading==false) //there's more data to load
{
loading = true; //prevent further ajax loading
$('.animation_image').show(); //show loading image
//load data from the server using a HTTP POST request
//http://www.nizilla.tk/profile php/userinterest.php
$.post('http://www.nizilla.tk/profile php/userinterest.php',{'group_no': track_load}, function(data){
$("#container").append(data); //append received data into the element
//hide loading image
$('.animation_image').hide(); //hide loading image once data is received
track_load++; //loaded group increment
loading = false;
}).fail(function(xhr, ajaxOptions, thrownError) { //any errors?
alert(thrownError); //alert with HTTP error
$('.animation_image').hide(); //hide loading image
loading = false;
});
}
}
});
}
});
It would be really helpful if you can point out my mistake here..i really appreciate your help