I'm using this code http://www.9lessons.info/2010/10/pagination-with-jquery-php-ajax-and.html
and it's works great , I want to add button to let the user change the view from vertical to horizontal
I edited load_data.php and added all the code it's need.
in controller I edited:
data: "page="+page,
to
data: "page="+page+"&view="+1,
and added the button(btn_view) in controller but I can't make it work ( change the value from 1 to 2)
and added
$('#btn_view').live('click',{ view: "2" },function(){
loadData(1);
});
after
$('#go_btn').live('click',function(){
var pagea = parseInt($('.goto').val());
var no_of_pages = parseInt($('.total').attr('a'));
if(pagea != 0 && pagea <= no_of_pages){
loadData(pagea);
}else{
alert('Enter a PAGE between 1 and '+no_of_pages);
$('.goto').val("").focus();
return false;
}
});
how to make the button reload the controller and change view value to 2 in load_data.php
.ajax()
it is preferably done like thisdata: { foo: "bar" }
api.jquery.com/jQuery.ajax – Pedro Estrada Dec 4 '13 at 18:46