I am currently redirecting the user to payment confirmation page if cash is selected from the dropdown list.
<select class="custom-select " id="payment" name= "pay_method" onchange="SelFunction()" required>
<option value=""> Select the Pay Method </option>
<option value="credit card"> Credit Card </option>
<option value="cash"> Cash </option>
</select>
<script>
function SelFunction() {
var x = document.getElementById("payment").value;
if (x == 'cash') {
window.location.href = "{% url 'payment_confirmation' %}";
}
};
</script>
This code is not posting any values to views files. I have tried with both request.POST and request.GET methods and none are working. Is there a way I can fetch the values from a template?