Ajax pagination with MySQL, PHP and jQuery Method 1: Javascript : <script type="text/javascript"> $(document).ready(function(){ function loading_show(){ $('#loading').html("<img src='images/loading.gif'/>").fadeIn('fast'); } function loading_hide(){ $('#loading').fadeOut('fast'); } function loadData(page){ loading_show(); $.ajax ({ type: "POST", url: "load_data.php", data: "page="+page, success: function(msg) { $("#container").ajaxComplete(function(event, request, settings) { loading_hide(); $("#container").html(msg); }); } }); } loadData(1); $('#container .pagination li.active').on('click',function(){ var page = $(this).attr('p'); loadData(page); }); }); </script> ...
Coding Cheatsheets - Learn web development code and tutorials for Software developers which will helps you in project. Get help on JavaScript, PHP, XML, and more.