I need to get the id of the button when I click ---
This is my code for my button to dynamically dynamically display data when the condition is true.
Twig:
{% for usr in userstats %} {% if usr.condition == TRUE %} <button type="submit" class="btn btn-success btn-xs myOnButton.onclick = function(event){alert(event.currentTarget.id);} myOnButton">Allow</button>
this is my ajax for my button ---
<script> $(".myOnButton").on('click', function () { if (confirm('{% trans %}Are you sure?{% endtrans %}')) { $('body').addClass('load'); var url = '/hello/hello';
To make it clearer: suppose we have in one column (name: Dell, CompanyId: 3001, Address- HelloDell, Phone-07555, condition: True), and in the other column we have (name: Apple, CompanyId: 5001, Address- HelloApple, Phone-07555, condition: True).
So, how can I get CompanyId when a button is clicked in a twig file?
Does anyone know any solution to this problem?
source share