i want to load an alert from js script that should only run if the condition is met:
Code:
{% if user_perm.up_slug != "view_hospitals" %}
<!-- <frame id="info" onload="errorLoad()"></frame> -->
<!-- <div id="info" onload="errorLoad()"></div> -->
<script type="text/javascript">
errorLoad();
function errorLoad()
{
$.confirm({
icon: 'fa fa-question-circle-o',
theme: 'supervan',
closeIcon: true,
animation: 'scale',
type: 'orange',
title: 'Sorry',
content: "Your not permitted to view this page",
buttons: {
"Go Home": function () {
window.location.replace('{{ base_url() }}/dashboard');
}
}
});
}
</script>
{% else %} ... {% endif %}
i know onload doesnt work on div, but what i want is if the condition is met on the if statement, then the script pops up an alert.
what i want is i want the function errorLoad() to run when the if condition is met