I displayed the data's from database
{% extends "layout.html" %}
{% block content %}
<article class="media content-section">
<div class="table-responsive">
<div class="table table-striped">
<table>
<thead>
<tr>
<th>Name</th>
<th>Phone Number</th>
<th> Send SMS </th>
</tr>
</thead>
{% for detail in details%}
<tbody>
<tr>
<th>{{ detail.username }}</th>
<th>{{ detail.phonenumber }}</th>
<th><button type="button" class="btn btn-success" onclick="'{{ url_for('sendsms', phonenumber = detail.phonenumber)}}'">Send Request</button></th>
</tr>
</tbody>
{% endfor %}
</table>
</div>
</article>
{% endblock content %}
HOW TO CALL THE FUNCTION AND PASS THE PHONE NUMBER WHEN THE BUTTON IS CLICKED?
When i pressed that button the sendsms function should called and the phonenumber should passed to this function.
My Route is
def sendsms(phonenumber):
account_sid = '************************'
auth_token = '*************************'
client = Client(account_sid, auth_token)
message = client.messages.create(
from_= current_user.username,
body='i need immediately'
to= phonenumber)
print(message.sid)