admin管理员组文章数量:1315237
There is a Jquery UI double range slider on my website. But I'm getting the slider's max and min values from my database.
$.ajax({
url: "init.php",
type: "GET",
data : {"method": "price"},
async: false,
success: function(data){
var result = JSON.parse(data);
price.min = result.min;
price.max = result.max;
}
});
So i have a
price = {
max: 0,
min: 1000
};
object and i give the new values values to the parameters in the ajax success function above.
$( "#slider-range" ).slider({
range: true,
min: price.min, //these don't work
max: price.max,
values: [ price.min, price.max ],
slide: function( event, ui ) {
$( "#amount" ).val( ui.values[ 0 ] + " Ft" + " - " + ui.values[ 1 ] + " Ft" );
},
change: function( event, ui){
var values ={
min: ui.values[0],
max: ui.values[1]
};
filter("price",values);
}
});
$( "#amount" ).val($( "#slider-range" ).slider( "values", 0 )
+ " Ft" + " - " + $( "#slider-range" ).slider( "values", 1 )+ " Ft");
Here is my JQuery UI double range slider object And I've got this error message in the console of the browser:
TypeError: max.toFixed is not a function[Learn More] jquery-ui.js:15006:26
There is a Jquery UI double range slider on my website. But I'm getting the slider's max and min values from my database.
$.ajax({
url: "init.php",
type: "GET",
data : {"method": "price"},
async: false,
success: function(data){
var result = JSON.parse(data);
price.min = result.min;
price.max = result.max;
}
});
So i have a
price = {
max: 0,
min: 1000
};
object and i give the new values values to the parameters in the ajax success function above.
$( "#slider-range" ).slider({
range: true,
min: price.min, //these don't work
max: price.max,
values: [ price.min, price.max ],
slide: function( event, ui ) {
$( "#amount" ).val( ui.values[ 0 ] + " Ft" + " - " + ui.values[ 1 ] + " Ft" );
},
change: function( event, ui){
var values ={
min: ui.values[0],
max: ui.values[1]
};
filter("price",values);
}
});
$( "#amount" ).val($( "#slider-range" ).slider( "values", 0 )
+ " Ft" + " - " + $( "#slider-range" ).slider( "values", 1 )+ " Ft");
Here is my JQuery UI double range slider object And I've got this error message in the console of the browser:
TypeError: max.toFixed is not a function[Learn More] jquery-ui.js:15006:26
Share Improve this question asked Jul 27, 2017 at 18:30 Howard FringHoward Fring 3051 silver badge13 bronze badges 20- And how do you return those values from the ajax call ? – adeneo Commented Jul 27, 2017 at 18:32
- price.min = result.min; price.max = result.max; – Howard Fring Commented Jul 27, 2017 at 18:32
- this is in the success function – Howard Fring Commented Jul 27, 2017 at 18:33
-
1
async : false
is deprecated in modern browsers, and shouldn't be used. – adeneo Commented Jul 27, 2017 at 18:36 - 1 I converted it to number and now it works, thanks @adeneo – Howard Fring Commented Jul 27, 2017 at 19:07
1 Answer
Reset to default 12The solution:
min: Number(price.min),
max: Number(price.max),
thanks @adeneo
本文标签: javascriptJQuery UI slider error (TypeError maxtoFixed is not a function)Stack Overflow
版权声明:本文标题:javascript - JQuery UI slider error (TypeError: max.toFixed is not a function) - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741982013a2408454.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论