fetch data from mysql when scroll

i want to make a webpage …on a PARTICULAR HEIGHT of scroll whenever user scrolls, data is fetch from mysql and shown to webpage like that does in facebook…i write code which works fine but if i specified particular height code stops working…i tried to alert the position of scroll which always gives ‘0’…
any help…code is below

html code: //here i called js
js code: function OnScrollDiv(xyz,pqrs) { //i had put it in head tag
var div1 =xyz;
var wer1 = document.getElementById(“iam1”).value;
var wer2 = document.getElementById(“iam2”).value;
var distancewe = $(“body”).scrollTop();
alert(distancewe);
if((distancewe > 100 ) && (distancewe < 200))
{
alert(distancewe);
var newhtml = “”;
if(wer1<82){ var we1=(wer11)+20; var we2=(wer21)+20;

         if (window.XMLHttpRequest){xmlhttp=new XMLHttpRequest();}
         else{ xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}

    xmlhttp.onreadystatechange=function(){
        if (xmlhttp.readyState==4 && xmlhttp.status==200)
         {
            document.getElementById("bhutsare").innerHTML=xmlhttp.responseText;
            document.getElementById("vid1").innerHTMl=newhtml;
            document.getElementById("iam1").value=we1;
            document.getElementById("iam2").value=we2;
         }
     }
           xmlhttp.open("GET","include/sabdikhao.php?kaua="+div1+"&lim1="+we1+"&lim2="+we2,true);
           xmlhttp.send();

} }
}

scrollTop returns the value of scroll to show this item, at case of body always are at 0.

can you use $(‘body’).scroll(), check this at JQuery api documentation, sorry but i don’t know how it’s works exactly.

Sponsor our Newsletter | Privacy Policy | Terms of Service