Nonetheless, I would prefer this to happen via ajax. It want an ajax function that removes the line with the id "connected-[wpv-post-id]" after processing the disconnection. It would work like this example.
jQuery('.disconnect').click(function() {
//replace remove-icon with loading animation
jQuery(this).html('<div class="lds-dual-ring dark"></div>');
//if Ajax succes: get the ID of the clicked element and delete the row
//var id = jQuery(this).attr('data-relateditemtwo');
//jQuery("#connected-"+id).remove();
//endif
});
But unfortunately, adding this jQuery breaks the functionality of the cred-delete-relationship shortcode. It shows the loader but not even the page refresh happens. Also, I would need the second part to only fire after the disconnection is processed. Any idea?
EDIT: Can s.o. please correct my title, there is a not so nice typo...
If you want to implement this with AJAX, you will have to create your own AJAX action and handler and call it with Javascript code. Check these articles:
- hidden link
- hidden link