\n'
);
// show modal
jQuery('#' + ref).show();
// prevent body from scrolling
jQuery('body').css('overflow', 'hidden');
// make request to load product details
UIAjax.do(
'https://deetaiwan.com/wp-admin/admin-ajax.php?view=tkadditem&tmpl=component&Itemid=18817&action=vikrestaurants&vik_ajax_client=site',
{
eid: id_entry,
oid: id_option,
index: index,
},
function(resp) {
// try to decode JSON response
try {
resp = JSON.parse(resp);
if (Array.isArray(resp)) {
// extract HTML from array
resp = resp.shift();
}
} catch (err) {
// no JSON, plain HTML was returned
}
jQuery('.vr-modal-body').html(resp);
},
function(error) {
if (!error.responseText || error.responseText.length > 1024) {
// use default generic error
error.responseText = Joomla.JText._('VRTKADDITEMERR2');
}
alert(error.responseText);
}
);
}
function vrCloseOverlay(ref) {
// make body scrollable again
jQuery('body').css('overflow', 'auto');
// hide overlay
jQuery('#' + ref).hide();
// clear overlay body
jQuery('.vr-modal-body').html('');
}
jQuery('.vr-modal-box').on('click', function(e) {
// ignore outside click
e.stopPropagation();
});
jQuery('.vr-overlay').on('click', function() {
// close overlay when the background is clicked
vrCloseOverlay(jQuery(this).attr('id'));
});