I am using ajax to generate a table, each row of this table represents a trip with a trip score and multiple cities. I want to add a "AddtoFavourite" button to each trip, once the user clicks on this button a django view will be called which will add the trip to the userss "Favs". Now my question is How to generate this URL for each row where I can pass city, tripname and trip score in the request
Here is the code which generates that table.
Please note datas
is the dict which contains list of trips, with each trip having a score and multiple cities in it.
searchresults.html
{% for data in datas %}
<tr>
<td>{{ data.score}}</td>
{% for element in data.place.elements %}
<td>
<img alt="" src="http://blankket-mk8te7kbzv.elasticbeanstalk.com/img/mapPinSmall.png">{{element.placeName}}
</td>
{% endfor %}
<td>
<input type="button" onlick=" " id="AddMyTrip" value="Add" class="btn btn-primary"/>
</td>
</tr>
{% endfor %}