My code is add div inside content normal. It adds banner div after 3th div with id= grid . But when i press button Load More it adds more 4 grid but does not add banner div rest of others any more.
This is my code for javascript and html
<script type="text/javascript"> $(document).ready(function(){ $.get("http:/domain.com/banner/" , function(data){ $("#column #grid:nth-child(2n)").after(data); }); var num_messages = <?=$num_messages?>; var loaded_messages = 0; $("#more_button").click(function(){ loaded_messages += 4; $.get("http:/domain.com/messages/" + loaded_messages, function(data){ $("#column").append(data); }); if(loaded_messages >= num_messages - 4) { $("#more_button").hide(); } }) }) </script>
<div id="column"> <div id="grid"></div> <div id="grid"></div> <div id="grid"></div> <div id="grid"></div> </div> <div id="more_button"> <p>Load More</p> </div>