Close a modal window after publishing data correctly

0

I'm using this modal window of material design which when you click on the close button closes, this same function of that button I want you to do it in the send button when you click and close after sending the data that is shown to me in the modal window.

Here is my js

$('body').on('click', '.publisher_timeline_js', function(event) 
{

    var _this = $(this);

    var publisher = _this.parents('.timeline');
    /* get handle */
    var handle = publisher.attr('data-handle');
    /* get text */
    var textarea = publisher.find('textarea');
    var attachments = publisher.find('.publisher-time-attach');
    var photos = publisher.data('uploading');
    var link = publisher.data('scrabing');

    $.post(api['/stream/store'], {'handle': handle, 'message': textarea.val(), 'photos': JSON.stringify(photos), 'datas': JSON.stringify(link)}, function(response) {
        //console.log(JSON.stringify(link));
        if (response.callback) {
            eval(response.callback);
        } else {
            textarea.val('');
            publisher.removeData('uploading');
            $('.publisher-timeline').html('').fadeOut();

            $('.file_up_drop').show();
            publisher.removeData('scrabing');
            attachments.hide();
            attachments.find('li.item').remove();

            //AQUI ES DONDE QUIERO QUE CIERRE LA VENTANA MODAL 

            if (response.message.type == 'photo') {

            } else if (response.message.type == 'link') {

            } else if (response.message.type == 'video') {

            } else if (response.message.type == 'rich') {

            } else if (response.message.type == 'text') {

            }

            //$('.timeline-publisher').prepend(template);
        }
    }, 'json');
});
    
asked by vdjkelly 19.09.2016 в 03:56
source

3 answers

2

Here is a simple vastante option: Javascript code onclick="window.opener.location.reload (); window.close (); "

this is if you use a pop-up window with iframe link

If you do it with a div on the same page, check the close buttons of a modal example.

    
answered by 15.10.2016 / 06:27
source
0

I do not know if you still need it or I do not know if it works, but you could try using something like

$("#idmodal").fadeOut();

I do not know if it works, but it's a simple idea.

    
answered by 20.09.2016 в 07:39
-2

location.reload();
When you confirm to submit of publishing the second one closes and the page refreshes you.

    
answered by 31.05.2018 в 02:40