Django и ajax - данные возвращают значение, но не заполняют поле
Я новичок в Django и Ajax. У меня есть выпадающее поле, которое заполняется из базы данных. Я хочу, чтобы другое поле заполнялось на основе выбора, сделанного в выпадающем списке. Я получаю возвращаемое значение, но оно не заполняет поле формы. Console.log показывает возвращаемое значение. Оно просто не отображается в поле формы, и я уверен, что имя поля правильно. В браузере я получаю 600. Как мне получить 600 в поле #id_Deductable? Любая помощь будет очень признательна.
`
<script>
$("#id_Primary_Plan").change(function () {
var url = $("#BaseQuoteForm").attr("data-agent-url"); // get the url of the `load_cities` view
var PlanData = $(this).val(); // get the selected country ID from the HTML input
$.ajax({ // initialize an AJAX request
url: url, // set the url of the request (= localhost:8000/hr/ajax/load-cities/)
data: {
'PlanData_id': PlanData // add the country id to the GET parameters
},
success: function (data) { // `data` is the return of the `load_cities` view function
console.log(data);
$("#id_Deductable").text(data); // replace the contents of the city input with the data that came from the server
}
});
});
</script>
`