Array Result after click price rangeHere I am trying to fetch products by passing price range inputs to controller function:
<script>
function send(){
var start = $('#amount_start').val();
var end = $('#amount_end').val();
//var dataString = "start" + start;
$.ajax({
type: 'get',
url: 'shop',
data: "start=" + start + "&end=" + end,
success: function(response) {
console.log(response);
}
});
}
Controller:
if ($request->ajax()) {
$start = $request->start;
$end = $request->end;
$Products = DB::table('products')->get();
return view('front.test')->with('Products', $Products);
} else {
$Products = DB::table('products')->paginate(6);
return view('front.shop', compact('Products'));
}
View File:
<label for="amount">Price range:</label>
<input type="text" id="amount_start" name="start_price" value="70" />
<input type="text" id="amount_end" name="end_price" value="150" />
<div id="slider-range"></div>
<button onclick="send()">Click me</button>
can you please help me around for some solution?
via hardeepcoder