how to change view's variable value in javascript. I mean when i select April from dropdown table will show only April's data and current table data will disappear and refreshed. How can i do it? Help me
My JS
:javascript
var updateMonth = function(){
var month_id = $("#select_other_month").val();
console.log(month_id)
}
here is my select tag (dropdown)
%select{:name => "options", :id=>"select_other_month",:onchange=>"updateMonth()"}
%option.placeholder{:disabled => "", :selected => "", :value => ""} see other months
%option{:value => "0"} this month
-a=@this_month - 1.month
%option{:value => "5"}=a.strftime('%Y-%m')
-b=@this_month - 2.month
%option{:value => "4"}=b.strftime('%Y-%m')
-c=@this_month - 3.month
%option{:value => "3"}=c.strftime('%Y-%m')
-d=@this_month - 4.month
%option{:value => "2"}=d.strftime('%Y-%m')
-e=@this_month - 5.month
%option{:value => "1"}=e.strftime('%Y-%m')
and my table looks like this
.table{:id=>"time_table"}
%table{:border=>"1"}
%thead
%tr
%th No
%th Name
-(@xmonth.at_beginning_of_month..@xmonth.at_end_of_month).each do |day|
-if (day.saturday? || day.sunday?)==false
%th=day.strftime("%d")
%th Total days
%th Total time
I want change my @xmonth vairable from JS
Note: @this_month = Date.today
Aucun commentaire:
Enregistrer un commentaire