1

I have a Jquery range slider (two values). I am trying to set the value from JSON:

$.ajax({
        url: '/SensorDatas/LoadSettings',
        type: 'GET',
        contentType: 'application/json;',
        dataType: "json",
        async: true,
        processData: false,
        cache: false,
        success: function (result) {
            $("#sensor1slide").slider('option','values',0, result.sensor1min);
            $("#sensor1slide").slider('option','values',1, result.sensor1max);
        },
        error: function (xhr, ajaxOptions, thrownError) { alert(xhr.responseText); $("#loading").val("Error"); }
    })

My sliders are not being updated, even though I know the values are being returned. I was wondering if it was because they are not cast correctly?

When I analysis the browser console I get this error:

TypeError: $(...).slider is not a function
$("#sensor1slide").slider('option','values',0, result.sensor1min);
tomdertech
  • 497
  • 1
  • 9
  • 27
  • 1
    this error means that your plugin is not defined. Did you add a reference to the plugin files? did you check if they are loading? – Raja Khoury Jun 09 '15 at 13:22
  • @AwRak - they are loading and working. I am using their value in another widget, I just cannot seem to programmatically set the value – tomdertech Jun 09 '15 at 13:32
  • the way you wrote it you're getting the value,not setting it. Try var min=result.sensor1min;var max= result.sensor1max; $( "#sensor1slide" ).slider({values: [ min,max ]}); – loli Jun 09 '15 at 13:39

0 Answers0