Topic: Passing Variable from Jquery Slider to Javascript Function

I'm relatively new to rails and stuggling passing a variable from my jquery slider to a separate js function.

In my view, I have 4 individual javascript charts (using highcharts). The data function section of the chart looks like this:

$(function () {
...
      pointStart: <%= 4.weeks.ago.at_midnight.to_i * 1000 %>,
      data: <%= data_chart_series(radacct_data, 4.weeks.ago) %>
...

Using Jquery UI slider, I have something like this:

$(function() {
    $( "#x_slider" ).slider({
    value: 4,
    step: 1,
    min: 1,
    max: 52,
    stop: function(event, ui) {
      var weeks = $('#x_slider').slider('option', 'values');
       $('#x_low_selected').html(weeks[0]);
       $.ajax({
         type: "GET",
         data: ({ low: weeks[0]}),
         url: $(this).attr('data-href'),
         dataType: 'script'
       });
     }
   });
 });

I need to send the value X from the slider to the 4.weeks.ago section. Any suggestions???

Last edited by simonmorley (2012-01-25 05:14:27)