Skip to content

Instantly share code, notes, and snippets.

@slifin
Created January 27, 2015 09:24
Show Gist options
  • Save slifin/4386747f51b187ac4bbd to your computer and use it in GitHub Desktop.
Save slifin/4386747f51b187ac4bbd to your computer and use it in GitHub Desktop.
JavaScript button on click handler for showing data
/**
* Read Book button.
*/
$('.read-book-button').on('click', function(event){
event.preventDefault();
if ( !sameIds ) {
var id = $(this).data('id');
$.ajax({
type: 'post',
dataType: 'html',
url: sdesignsAjax.ajaxurl,
data: {
action : 'sdesigns_ajax_bookblock_function',
id : id,
sameIds : sameIds
},
success: function(html) {
console.log('same ids false');
ajaxSuccess(html);
$('#book-container').addClass('showBook');
resizeBook();
$(window).trigger('debouncedresize');
}
});
} else {
$('#book-container').addClass('showBook');
resizeBook();
$(window).trigger('debouncedresize');
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment