简体   繁体   中英

Send ajax success response to jQuery Modal

How to send ajax success response to jQuery Modal ( jQuery Modal Site ) when i click submit and automatically show modal with response. This is my ajax to post:

$('#rincian').submit(function() {
    $.ajax({ 
        data: $(this).serializeArray(),
        type: $(this).attr('method'), 
        url: $(this).attr('action'), 
        success: function(response) { 
            $('#rinci').html(response); 
        }
    });
    return false; 
});

UPDATE Answered by Jossef

I have changed it to $('#rinci').html(response).modal();

$('#rincian').submit(function() {
    $.ajax({
        data: $(this).serializeArray(),
        type: $(this).attr('method'),
        url: $(this).attr('action'), 
        success: function(response) {
            $('#rinci').html(response).modal();
        }
    });
    return false;
});

http://jsfiddle.net/5WEVL/

$('#clickme').click(function() {
    $.ajax({ 
        url: '', 
        success: function(response) { 
            $('#modal-div').html(response).modal();
        }
    }); 
});

add .modal(); and it should work

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM