• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Solved] Ajax pagination links triggers off canvas to open?

#1
I am now using ajax for my codeigniter pagination but when I click on my pagination links It triggers the off canvas to open

How can I prevent the off canvas to open when I click on my pagination links?


PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
var 
menuToggle = $('.toggle-button');
var 
menuToggleIcon menuToggle.find('.fa');
var 
offCanvas = $('.offcanvas');
var 
content = $('.content');

menuToggle.click(function() {
closeMenu(menuToggleIconoffCanvas);
});

content.click(function() {
    closeMenu(menuToggleIconoffCanvas);
});

function 
closeMenu(menuToggleIconoffCanvas) {
    menuToggleIcon.toggleClass('fa-indent fa-outdent');
   offCanvas.toggleClass('open');
}

}); 
</script> 



PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
function 
load_users_data(page){
  $.ajax({
  url:"<?php echo base_url(); ?>dashboard/users_pagination/" page,
  method:"GET",
  dataType:"json",
  success:function(data) {
   $('#users_table').html(data.users_table);
   $('#user_pagination_link').html(data.pagination_link);
  }
  });
}

load_users_data(1);

$(
document).on("click"".user-pag li a", function(event){
  event.preventDefault();
  var page = $(this).data("ci-pagination-page");
  load_users_data(page);
});

});
</script> 


PHP Code:
<script type="text/javascript">
$(
document).ready(function() {
function 
load_users_data(page){
  $.ajax({
  url:"<?php echo base_url(); ?>dashboard/users_pagination/" page,
  method:"GET",
  dataType:"json",
  success:function(data) {
   $('#users_table').html(data.users_table);
   $('#user_pagination_link').html(data.pagination_link);
  }
  });
}

load_users_data(1);

$(
document).on("click"".user-pag li a", function(event){
  event.preventDefault();
  var page = $(this).data("ci-pagination-page");
  load_users_data(page);
});

});
</script> 


Attached Files
.php   Dashboard.php (Size: 3.13 KB / Downloads: 37)
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply

#2
I solved it couple of things I have had to do 

Is on the offcanvas script I had to remove the code that I had and just use 


PHP Code:
$(document).ready(function() {

$(
'.navbar-brand').on('click', function() {
$(
'.offcanvas').toggleClass('open');
});

}); 

And add e.preventDefault();  e.stopPropagation(); same with question-pag


PHP Code:
$(document).on("click"".user-pag li a", function(e){
    e.preventDefault();
    e.stopPropagation();
     var page = $(this).data("ci-pagination-page");
     load_users_data(page);
}); 
There's only one rule - please don't tell anyone to go and read the manual.  Sometimes the manual just SUCKS!
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


Users browsing this thread:
1 Guest(s)


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2017 MyBB Group.