[Fixed]-Django request in html

1👍

one way could be to trigger an ajax call when you click that button, and then process the response as you wish.

The button’s html could be something like this:

<button onclick="processCalculation()">Calculate!</button>

Something like this function:

function processCalculation(){
  var para1 = $("#params-container").val();
  var text = $("#text-container").val();
  $.ajax({
       url: "/calculate-X/" + para1 + "/" + text,
       data: {}
    }).done(function (jsonResponse) {
        alert(jsonResponse)
 });

}

I hope this points you on the right direction, Best regards!

Leave a comment