In his article, we are going to look at how to call an endpoint and read the JSON response using AJAX call. Also, we will see how we append and pass URL parameters to that endpoint URL. Below is the code snippet.
var data is a type of object, that holds all the URL parameters that get appended with endpoint URL when AJAX calls the endpoint.
<script> function myFunction() { var amount = document.getElementById("tuition-amount").value; var startDate = document.getElementById("start-date").value; var endDate = document.getElementById("end-date").value; var data = { startDate:"01/25/2022", endDate:"03/12/2022", paymentDate:"01/02/2022", campus:"delhi"}; $.ajax({ type: "GET", url: "https://rashidjorvee/services/latefine.cfm", data: data, success: function(response) { document.getElementById("late-fine-amount").innerHTML = response.amount; }, dataType: "json" }) } </script>