i have this jquery code, ajax, whch helps me to do some pagination.
Now, i grab the data from a php file which has only some information printed.
The index file is this one:
<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); // For first time page load default results
$('#container .pagination li.active').live('click',function(){
var page = $(this).attr('p');
loadData(page);
});
});
});
</script>
What i want to do is that, i want to reload the page only if i am on the first page, i mean, in pagination we have something like:
<- 1 2 3 4 5 6 7 ->
I want to reload the content without refreshing only if i'm on the first page. Can someone help me with that? Thanks!