1jQuery(document).ready(function($) { 2 3 $('.institution-loadmore').click(function(){ 4 5 var button = $(this), 6 data = { 7 'action': 'loadmore', 8 'query': institution_loadmore_params.posts, // that's how we get params from wp_localize_script() function 9 'page' : institution_loadmore_params.current_page 10 }; 11 12 $.ajax({ // you can also use $.post here 13 url : institution_loadmore_params.ajaxurl, // AJAX handler 14 data : data, 15 type : 'POST', 16 beforeSend : function ( xhr ) { 17 button.text('Loading...'); // change the button text, you can also add a preloader image 18 }, 19 success : function( data ){ 20 if( data ) { 21 button.text( 'LOAD MORE' ); 22 $('#institution-network .append-loadmore').append(data); // insert new posts 23 institution_loadmore_params.current_page++; 24 25 if ( institution_loadmore_params.current_page == institution_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 37});
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.