1jQuery(document).ready( function($){ 2// Some event will trigger the ajax call, you can push whatever data to the server, 3// simply passing it to the "data" object in ajax call 4$('.saveoptions').on('click', 'div.savepost', function(){ 5 var postID = $("#postID").val(); 6 var userID = $("#userID").val(); 7 $.ajax({ 8 url: ajax_object.ajaxurl, // this is the object instantiated in wp_localize_script function 9 type: 'POST', 10 data:{ 11 action: 'savepost', // this is the function in your functions.php that will be triggered 12 postid: postID, 13 userid: userID 14 }, 15 success: function( data ){ 16 //Do something with the result from server 17 console.log( data ); 18 } 19 }); 20 $('.savepost').html('<i class="fas fa-bookmark"></i> Saved'); 21 $('.savepost').addClass('savedpost').removeClass('savepost'); 22 23 $('<div class="deletepost"><i class="fas fa-minus-circle"></i> Remove</div>').insertBefore( $('.managepost') ); 24 $('.deletepost').css({"margin": "0 5px 5px 0"}); 25}); 26 27$('.saveoptions').on('click', 'div.deletepost', function(){ 28 var postID = $("#postID").val(); 29 var userID = $("#userID").val(); 30 $.ajax({ 31 url: ajax_object.ajaxurl, // this is the object instantiated in wp_localize_script function 32 type: 'POST', 33 data:{ 34 action: 'deletepost', // this is the function in your functions.php that will be triggered 35 postid: postID, 36 userid: userID 37 }, 38 success: function( data ){ 39 //Do something with the result from server 40 console.log( data ); 41 } 42 }); 43 $('.deletepost').fadeTo(1000, 0.01, function(){ 44 $(this).slideUp(150, function() { 45 $(this).remove(); 46 }); 47 }); 48 $('.savedpost').addClass('savepost').removeClass('savedpost'); 49 $('.savepost').html('<i class="far fa-bookmark"></i> Save'); 50}); 51$('.userposts').hover( 52 function(){ 53 var neededID = $(this).attr("id"); 54 var splitID = neededID.split("_"); 55 var postID = splitID[0]; 56 var userID = splitID[1]; 57 var htmlAdd = `<div class="deletepostsmall"><i class="fas fa-minus-circle"></i><input type="hidden" id="status" value="delete" /><input type="hidden" id="postID" value="${postID}" /><input type="hidden" id="userID" value="${userID}" /></div>`; 58 $(this).prepend(htmlAdd); 59 }, 60 function(){ 61 $('.deletepostsmall').remove(); 62 } 63); 64 65$('.userposts').on('click', 'div.deletepostsmall', function(){ 66 var postID = $("#postID").val(); 67 var userID = $("#userID").val(); 68 var containerID = postID+"_"+userID; 69 console.log(containerID); 70 $.ajax({ 71 url: ajax_object.ajaxurl, // this is the object instantiated in wp_localize_script function 72 type: 'POST', 73 data:{ 74 action: 'deletepost', // this is the function in your functions.php that will be triggered 75 postid: postID, 76 userid: userID 77 }, 78 success: function( data ){ 79 //Do something with the result from server 80 console.log( data ); 81 } 82 }); 83 $(`#${containerID}`).fadeTo(1000, 0.01, function(){ 84 $('#'+containerID).slideUp(150, function() { 85 $('#'+containerID).remove(); 86 }); 87 }); 88}); 89});
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.