Pierre Dommerc pro asked 7 years ago


Hi, I try to use your alert component. In my view I have this code : (I use twig for my template)
{% if error %}
// display the alert message
{% endif %}
I think I have to use Jquery for automaticaly display the alert. But I need help for this. thanks !

Pierre Dommerc pro answered 7 years ago


Of course, I use this :
    {% for flash_message in app.session.flashBag.get('notice') %}
        <script>
            $( document ).ready(function() {
                toastr.success('{{ flash_message }}');
            });
        </script>
    {% endfor %}


Can you tell us how did you resolve your problem?

Pierre Dommerc pro answered 7 years ago


Ok it's done.

Pierre Dommerc pro answered 7 years ago


It is not working, currently when I have an alert message, nothing is displaying. More precisly I have to adapt alert component to this code :

        {% for flash_message in app.session.flashBag.get('notice') %}
        {{ flash_message }}
        {% endfor %}
And flash_message is a variable of string type. Can you help me ?

Pierre Dommerc pro answered 7 years ago


Ok thank you.

Yes, you need to use jQuery. Try to use this code:
{% if error %}
<script type="text/javascript">
	$(document).ready() {
		toastr.error('Error');
	}
</script>
{% endif %}


Please insert min. 20 characters.

FREE CONSULTATION

Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.

Status

Specification of the issue

  • ForumUser: Pro
  • Premium support: No
  • Technology: General Bootstrap questions
  • MDB Version: -
  • Device: -
  • Browser: -
  • OS: -
  • Provided sample code: No
  • Provided link: No
Tags