Load more functionality in custom component Joomla

Select your language

Here is pagination code snippet:

 

<?php
$config = Factory::getConfig(); $list_limit= $config->get('list_limit'); $limit_start= $input->get('limit_start', '0', 'string'); ?> <div id="row_result">Ajax result will be loaded here.</div><!-- row_result -->
<input type="hidden" id="limit_start" value="<?=$limit_start+$list_limit?>" /> <button id="loadmore">Load more</button> <!--
Be sure your code has loaded jquery, and noconflict code added too,
------>
<script type="text/javascript"> jQuery(document).ready(function ($) { var limit_start; jQuery('#loadmore').click(function(e) { limit_start=jQuery('#limit_start').val(); jQuery.ajax({ url: "index.php?option=com_advertise&id=<?=$txtCate?>&task=advertise.loadmore", data: "limit_start="+limit_start+"&list_limit=<?=$list_limit?>", type: "get", success: function(response){ jQuery(".row_result").append(response); } }); }); }) </script>

<!--
CSS style to pagination and Loadmore button
------------->
<style> #loadmore { background-color: #2EAF7A; color:white; width: 100%; padding: 16px; margin:15px auto; border: none; cursor: pointer; transition: all 200ms ease-in-out; border-radius: 3px; font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.15rem; } #loadmore:not([disabled]):hover { box-shadow: 0 1px 9px rgba(0, 0, 0, 0.2); } #loadmore[disabled] { background-color: #eaeaea !important; } #pagination { text-align:center; margin:0 auto; } .pagination { display:inline-flex !important; } .page-item.active .page-link { background-color: #14a800; color: #EDF5E1; } span.icon-angle-left::before { content: "\F276"; } span.icon-angle-double-left::before { content: "\F279"; } span.icon-angle-right::before { content: "\f277"; } span.icon-angle-double-right::before { content: "\F280"; } span.icon-angle-left::before, span.icon-angle-double-left::before, span.icon-angle-right::before, span.icon-angle-double-right::before { display: inline-block; font-family: bootstrap-icons !important; font-style: normal; font-weight: normal !important; font-variant: normal; text-transform: none; line-height: 1; vertical-align: -0.125em; }
</style>

 Hope this helped.


Still need help! no problem, feel free to contact us Today


 Abdul Waheed : (Hire Joomla & PHP Pakistani Freelancer)