Skip to content

Instantly share code, notes, and snippets.

@jmcausing
Created June 21, 2020 23:18
Show Gist options
  • Save jmcausing/170292a5273b561f30bf2a5df159b750 to your computer and use it in GitHub Desktop.
Save jmcausing/170292a5273b561f30bf2a5df159b750 to your computer and use it in GitHub Desktop.
jQuery(document).ready(function ($) {
// Create contents -- START
$( ".wcg_submit" ).click(function() {
post_type = jQuery('select.wgc_post_type').val();
qty = jQuery('.wcg_count').val();
data = {
"action": "wcg_start_generate",
"post_type": post_type,
"post_qty": qty,
};
$.ajax({
url : "/wp-admin/admin-ajax.php",
data : data,
type : "POST",
beforeSend : function ( xhr ) {
// loading animation
$('.wcg_loading_create').css('display','block');
$('.wcg_preloader_create_h1').css('display','block');
$('.wcg_loading_create_done').css('display','none');
$('.wcg_loading_delete_done').css('display','none');
},
success : function( data ){
$('.wcg_loading_create_done').css('display','block');
$('.wcg_loading_create').css('display','none');
$('.wcg_preloader_create_h1').css('display','none');
$('.wcg_loading_delete_done').css('display','none');
console.log(data);
}
});
});
// Create contents -- END
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment