Zaki
Zaki

Reputation: 5600

Lightbox/Colorbox to open once ajax success call has been made

I have an AJAX call to a function as follows:

$("#<%=gridview.ClientID%> tr:has(td)").click(function(e) {
    var id = $(this).children("td:eq(3)").find(':input').val();
    $.ajax({
        type: "POST",
        url: "Docs.aspx/BtnTest",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            if (msg.d == 'Success') {
                window.open('/view.aspx?Id=' + id, '_blank');
            }
        }
    });
    e.preventDefault();
});

As you can see in above code on success I am opening another page with id as querystring. How can I call Colorbox or any other lightbox plugin to open this in iframe?

Upvotes: 0

Views: 647

Answers (1)

webdeveloper
webdeveloper

Reputation: 17288

Try this:

$.colorbox({ href: 'your link goes here', iframe:true, width:"80%", height:"80%"});

Same problem: add colorbox to dynamicly created item with url content

Upvotes: 1

Related Questions