Reputation: 565
I am trying to display an HTML string Programmatically in Fancybox 3, but I get the following error: 'Failed to execute 'getComputedStyle' on 'Window': parameter 1 is not of type 'Element'.
I did try to change the type to 'Inline' and using a href, but no luck. I also tried to change Content to data without the extra GetHTML variable.
I looked at this post, but no luck: JS: Failed to execute 'getComputedStyle' on 'Window': parameter is not of type 'Element'
I also had a look at this post: Loading dynamic AJAX content into Fancybox
$('.LinkFancybox').on('click', function () {
var CategoryID = $(this).attr("id");
var UserID = "<%=CurrentUserId%>";
var CompanyID = "<%=CompanyID%>";
var CurrentCustomerCode = "<%=CurrentCustomerCode%>";
if (CurrentCustomerCode == "") {
CurrentCustomerCode = "000-000";
}
var APIURL = $.fn.GetBaseURL() + 'DesktopModules/DNNCommon/API/Store/GetProductsForPubCat?CategoryId=' + CategoryID + '&UserID=' + UserID + '&CompanyID=' + CompanyID;
$.ajax({
type: "GET",
async: true,
url: APIURL,
datatype: "json",
success: function (data) {
var GetHTML = data;
$.fancybox.open({
type: 'ajax',
width: 800,
height: 800,
autoSize: false,
content: GetHTML
});
},
error: function (xhr, ajaxOptions, thrownError) {
console.log(xhr.responseText);
}
});
});
Upvotes: 0
Views: 187
Reputation: 8769
If you wish to display HTML content, then content type should be html
, e.g., change to type: 'html'
.
Upvotes: 1