Remove html form after request

This commit is contained in:
TomMago 2020-09-03 17:43:58 +02:00
parent 2d27356979
commit ad9db0c907

View file

@ -174,12 +174,13 @@ $(document).ready(function() {
// Event from button accept from the modal // Event from button accept from the modal
$(".deletePageModalAcceptButton").on("click", function() { $(".deletePageModalAcceptButton").on("click", function() {
$( "body" ).append("<iframe id='formSendingIframe' name='formSending'></iframe>"); $( "body" ).append("<iframe id='formSendingIframe' name='formSending' style='display:none;'></iframe>");
var form = jQuery('<form>', { var form = jQuery('<form>', {
'action': HTML_PATH_ADMIN_ROOT+'edit-content/'+key, 'action': HTML_PATH_ADMIN_ROOT+'edit-content/'+key,
'method': 'post', 'method': 'post',
'target': 'formSending' 'target': 'formSending',
'id': 'requestForm'
}).append(jQuery('<input>', { }).append(jQuery('<input>', {
'type': 'hidden', 'type': 'hidden',
'name': 'tokenCSRF', 'name': 'tokenCSRF',
@ -201,8 +202,9 @@ $(document).ready(function() {
// Wait for request to finish before updating search results // Wait for request to finish before updating search results
$('#formSendingIframe').on( 'load', function() { $('#formSendingIframe').on( 'load', function() {
$('.select2-search__field').trigger("input"); $('.select2-search__field').trigger("input");
} ); $('#requestForm').remove();
$('#formSendingIframe').remove();
});
}); });
}); });
</script> </script>