I have an input that would like to change the data-min and date-max with the value brought by AJAX by changing the value of the select category_id. Ajax is bringing the value correctly, but does not change the value of the data-min and data-max.
HTML
<select id="category_id" class="form-control" name="category_id" required>
<option value="">Selecione</option>
@foreach($categories as $category)
<option value="{{$category->id}}">{{ $category->name }}</option>
@endforeach
</select>
<input type="text" id="range_01" data-min="0" data-max="0">
$("#category_id").change(function() {
var category = $(this).val();
$.ajax({
type:'GET',
url:'/customer/orders/lowerValueService/' + category,
success:function(data){
var value = data;
console.log(value);
$("#range_01").data("min", value);
},
error: function(){
console.log("Erro");
}
});
$.ajax({
type:'GET',
url:'/customer/orders/highestValueService/' + category,
success:function(data){
var value = data;
console.log(value);
$("#range_01").data("max", value);
},
error: function(){
console.log("Erro");
}
});
});