1 2jQuery(function($){ 3 //var loaded_posts = parseInt($(".mb_loadmore_num").text()); 4 $('.mb_loadmore').click(function(e){ 5 e.preventDefault(); 6 var button = $(this), 7 data = { 8 'action': 'loadmore', 9 'query': mb_loadmore_params.posts, 10 'page' : mb_loadmore_params.current_page 11 }; 12 13 $.ajax({ 14 url : mb_loadmore_params.ajaxurl, // AJAX handler 15 data : data, 16 type : 'POST', 17 beforeSend : function ( xhr ) { 18 button.text('Chargementâ¦'); // change the button text, you can also add a preloader image 19 }, 20 success : function( data ){ 21 if ( data ) { 22 //console.log(mb_loadmore_params) 23 button.text( 'Afficher plus dâactualités' ).parent().prev().append(data); // insert new posts 24 mb_loadmore_params.current_page++; 25 26 //loaded_posts += data.length; 27 $(".mb_loadmore_num").text($(".post-article").length); 28 29 if ( mb_loadmore_params.current_page == mb_loadmore_params.max_page ) 30 button.remove(); // if last page, remove the button 31 32 // you can also fire the "post-load" event here if you use a plugin that requires it 33 // $( document.body ).trigger( 'post-load' ); 34 } else { 35 button.remove(); // if no data, remove the button as well 36 } 37 } 38 }); 39 }); 40}); 41 42 43
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.