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?