1jQuery(function($){ // use jQuery code inside this to avoid "$ is not defined" error 2 $('.bliss_loadmore').click(function(){ 3 4 var button = $(this), 5 data = { 6 'action': 'loadmore', 7 'query': bliss_loadmore_params.posts, // that's how we get params from wp_localize_script() function 8 'page' : bliss_loadmore_params.current_page, 9 10 }; 11 12 $.ajax({ // you can also use $.post here 13 url : bliss_loadmore_params.ajaxurl, // AJAX handler 14 data : data, 15 type : 'POST', 16 beforeSend : function ( xhr ) { 17 button.hide(); 18 button.next().show(); // change the button text, you can also add a preloader image 19 }, 20 success : function( data ){ 21 if( data ) { 22 button.show().before(data); // insert new posts 23 bliss_loadmore_params.current_page++; 24 button.next().hide(); 25 if ( bliss_loadmore_params.current_page == bliss_loadmore_params.max_page ) 26 button.remove(); // if last page, remove the button 27 28 // you can also fire the "post-load" event here if you use a plugin that requires it 29 // $( document.body ).trigger( 'post-load' ); 30 } else { 31 button.remove(); // if no data, remove the button as well 32 } 33 } 34 }); 35 }); 36});
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.