I have an ajax call which returns a partial view which I want to dump into a colorbox modal. I have tried all sorts of different ways but it just opens up with something like “Content cannot be displayed”. I have checked the data being returned and it is definitely the partial view so I don’t know why it’s failing to display it. I also tried the jQuery plugin simple modal which I was able to use very easily to display the same partial view by using $.modal(data). When I try the different ways below I get the error message.
$.ajax({
url: 'Controller/ControllerAction',
success: function(data) {
$(data).colorbox();
}
});
$.ajax({
url: 'Controller/ControllerAction',
success: function(data) {
$.colorbox(data);
}
});
$.ajax({
url: 'Controller/ControllerAction',
success: function(data) {
$.colorbox({html: data });
}
});
Any ideas would be greatly welcomed.
Try the following: