I create MY_form_helper.php
in application/helpers/
, extending form_helper.php
. The function is like this:
function alert($message,$type = 'success'){
$data = array(
'type' => $type,
'text' => $message
);
return json_encode($data);
}
In my controller I call the function like this:
$this->load->helper(array('form', 'url'));
echo alert('Wrong email or password');
but it gives me an error
Message: Call to undefined function alert()
so what am I missing or doing wrong here?