load content while scrolling not working
<p>I am writing a code which i scroll to the bottom of the window it loads another data with the help of php code.
   It loads the load_first.php file but not identifies the load_second.php file
  What problem in this code see this </p>

<pre><code>  &lt;?php $_SESSION['first']=1; if($_SESSION['first']==1) { ?&gt;
&lt;script type="text/javascript"&gt;
    $(window).scroll(function(){
        if($(window).scrollTop() == $(document).height() - $(window).height()){
            $('div#last_msg_loader').html('&lt;img src="loading.gif"&gt;');
            var data="cachekey=" + $('.cachekey').val()+"&amp;cachelocation="+ $('.cachelocation').val();

            $.ajax({
                url: "load_data.php?last_msg_id="+ID,
                data:data,
                error:function(error)
                {
                    alert(error);
                },
                success: function(html){
                    if(html){
                        $(".message_box:last").after(data); 
                        $('div#last_msg_loader').hide();

                    }else{
                        $('div#loadmoreajaxloader').html('&lt;center&gt;No more posts to show.&lt;/center&gt;');
                    }
                }
            });
        }
    });

&lt;/script&gt;
&lt;?php

include('load_first.php');

?&gt;



&lt;?php
}
else
{

  include('load_second.php');       

    }
    ?&gt;  
    &lt;div id="last_msg_loader"&gt;&lt;/div&gt;
</code></pre>

<p>Actually this code is used to load the hotel list using xml api of expedia</p>
