smoke.js
smoke.js copied to clipboard
can I use smoke.js to have an notification without a click
Dear all I would like to use smoke.js for my site, unfortunately I do not have much knowledge of javascript, neither on php but OK I trying to learn. What I have and I need to change is when I submit for something (e.g for contact) if is successful or not returns an output a simple link like this
$title = $error == 0 ? l(completed_ok') : ($error !== 0? l('error') : l('warning'));
$note = (!$note || empty($note)) ? '' : '<p>'.$note.'</p>';
$goto = '<p><a href="'._URL.'">'.l('home').'</a></p>';
$output = '<h3>'.$title.'</h3>'.$note.$goto;
My question is can I use smoke.js to have an notification without a click and If I am not asking too much, is it possible to give me any example! Thank in advance.
yeah, you totally can (i do it all the time in the custom admins i make). it's kinda hard to tell where it would fit in with this code, but you can execute it without a click by just calling smoke.signal() in a normal javascript context. i could try to help further if i had more of an idea of what all is happening with your script.
Hi jyoungblood thanks for your reply you help me a lot simply like this I get all the information I need and I got smoke :)
?>
<script type="text/javascript">
smoke.signal('<?php echo $output; ?>');
</script>
<?php
But I got one small issue, is there any trick to make it work by adding the smoke.js in the bottom of html instead of top?