Skip to content

Instantly share code, notes, and snippets.

@ankitnetwork18
Created January 11, 2013 07:00
Show Gist options
  • Save ankitnetwork18/4508550 to your computer and use it in GitHub Desktop.
Save ankitnetwork18/4508550 to your computer and use it in GitHub Desktop.
jQuery: Reload Part of Page without Refresh and also events will work
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
$(document).on("click", "a.next_button", function(){
var id = parseInt($(this).attr('id').split('_')[2],10);
var id_to_show = id+1;
$('div.data_div_'+id).hide();
$('div.data_div_'+id_to_show).show();
});
$(document).on("click", "a.prev_button", function(){
var id = parseInt($(this).attr('id').split('_')[2],10);
var id_to_show = id-1;
$('div.data_div_'+id).hide();
$('div.data_div_'+id_to_show).show();
});
//reload cricket data
setInterval(function(){
$('div#match_wrapper').load(location.href + ' #match_wrapper');
}, 60000);
});
</script>
@raihan71
Copy link

dont use it will blow your browser,use setTimeout instead

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment