Created
January 11, 2013 07:00
-
-
Save ankitnetwork18/4508550 to your computer and use it in GitHub Desktop.
jQuery: Reload Part of Page without Refresh and also events will work
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<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> |
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
,,