I'm using jQuery to get data from api but the data is not displaying in edit form.
edit function:
function Edit(id) {
$.getJSON("https://localhost:7018/api/Students/GETBYID?id=" + id, function (student) {
$("#ed-id").val(student.id),
$("#ed-name").val(student.name)
$("#ed-department").val(student.department),
}),
window.location.replace("https://localhost:7196/Student/Edit")
}
edit button
"<button class ='btn-success' class='btn btn-primary' onclick='Edit(" + student[i]["id"] + ")'> Edit </button>"
I want to get values from my file using webapi and then use them is edit/update form but on clicking button only the blank form is opening.