0
更新输入选择选项我有简单的形式与该输入:Ruby on Rails的 - 使用AJAX
<%= f.input :seleced_seats, collection: @event.seats, label: "-", label_html: { style: 'visibility: hidden; height: 0px;'}, include_blank: false %>
它包含了我想用AJAX来更新选项。 JavaScript的,我得到的输入(data.seats)数组是:
$("#event_seleced_seats").change(function(){
var seleced_seats = $(this).val();
var seleced_term = $("*[class='list-group-item active']").attr('id');
jQuery.getJSON(window.location.href + "/price", {edition: seleced_seats, term: seleced_term}, function(data) {
$("#price").text(data.total_price);
$("#termA").text(data.seats);
console.log(data.seats);
});
});
我如何重绘从data.seats数据f.input?