Question

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;
});
Was it helpful?

Solution

http://jsfiddle.net/5WEVL/

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

add .modal(); and it should work

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top