1

I am trying to use Knob with AJAX, and it is working, but the progress bar is not changing, only the number inside real time.

You can check it here: www.skincannon.com

The code is: HTML:

<input id="val" type="text" value="0" /> <input type="button" value="Change" /> 

AJAX:

$.ajax({
    type: "GET",
    url: "currentitemswidth.php",
    success: function(msg){
        $('#val').val(msg);
    }
});

And I am changing the value with ajax, but the bar won't change.

Anybody could help me? If you need further codes just tell me.

I need something like this, but I would like to change it automatically, not by hitting the Change button: http://www.jqueryajaxphp.com/dynamically-animate-jquery-knob/

Thanks

Soundar
  • 2,569
  • 1
  • 16
  • 24
Marias
  • 17
  • 5
  • Can you update a simple code to show how you tried.. And are you need the solution with same knob or any circular slider can use ? – Soundar Jan 29 '16 at 08:27
  • I didn't try anything because I am almost zero at JQuery, could you advise some new sliders? – Marias Jan 29 '16 at 09:30

1 Answers1

1

Here i have achieved your requirement with jQuery roundSlider plugin.. I think this is suitable for you, since you can easily customize the appearance and animation style of this slider.. Check the below demo:

Demo

For more details check the demos and documentation page.

Edit:

In the ajax success what value you got, you can assign that value to the slider. Like below:

$.ajax({
    type: "GET",
    url: "currentitemswidth.php",
    success: function(msg){
        $('#val').val(msg);

        // use the below code to dynamically update the roundSlider value
        $("#slider").roundSlider("option", "value", msg);
    }
});
Community
  • 1
  • 1
Soundar
  • 2,569
  • 1
  • 16
  • 24
  • Thanks it's almost the thing I wanted, with the only difference that I want it to change when the input value has changed by the ajax, not by clicking or writing anything, So how can I listen to the event of changing the value? Thanks in advance. – Marias Jan 29 '16 at 23:00
  • Yes, that is possible.. Can you tell which input value has changed by ajax.? Or can you update that ajax related code.. – Soundar Jan 30 '16 at 03:54