Here I have many users(with id,name,role defined) in html. When I click in one of the user It displays the modal and inside this modal I want to display the id,name and role of that user. I am only being able to dispaly id. How can I display name and role also ?
html
{% for user in users %}
<li>
<i class="fas fa-user-circle"></i>{{ user.name }}, {{user.role}}
<a href="" class="text-primary" onclick = "send_message({{user.id}} )">Message</a>
</li>
{% endfor %}
script
function send_message(id){
event.preventDefault();
$('#sendmessage').modal('show');
$('#send_message_modal_title').text("Send Message to User");
$('#sendmessage').on('shown.bs.modal', function (e) {
$("#user_id").val(id);
$("#user_name").val(name, role);
})
modal
<input name="cleaner" id="user_id">
<input type="text" value="name and role" class="form-control"> #how to display name and role ?