success: function(data)
{
console.log(data);
$('#results').html(data);
}
Is this your AJAX Request?
Guys i am working with a project
i am using search inajax
This is my controller before search
public function index()
{
$loc=Location_details::orderBy('created_at','desc')->paginate(10);
return view('Location_details.view')->withloc($loc);
}
This is my partials 'tbody'
@foreach($loc as $locs)
<tr>
<td>{{ $locs->ven_loc }}</td>
<td>{{ $locs->ven_area }}</td>
<td>{{ $locs->ven_booth }}</td>
<td>
{!! Form::open(['route'=>['Location_details.destroy',$locs->id], 'onsubmit' => 'return ConfirmDelete()','method'=>'Delete']) !!}
<a href="{{ route('Location_details.edit',$locs->id) }}" class="btn btn-info glyphicon glyphicon-edit"></a>
<button type="submit" class="btn btn-info glyphicon glyphicon-trash">
</button>
</td>
{!! Form::close() !!}
</tr>
@endforeach
This is my view
<tbody id="results">
@include('Location_details.tbody')
</tbody>
</table>
<div class="text-center">
{!! $loc->Links(); !!}
</div>
This is my search_Location controller
public function search_location_details( Request $request )
{
$loc = Location_details::where(function ($query) use ($request)
{
if (!empty($request->location)) {
$query->Where('ven_loc', 'LIKE', '%' . $request->location . '%');
}
if (!empty($request->area)) {
$query->Where('ven_area', 'LIKE', '%' . $request->area . '%');
}
if (!empty($request->booth)) {
$query->Where('ven_booth', 'LIKE', '%' . $request->booth . '%');
}
})->orderBy('created_at','desc')->paginate(10);
return view('Location_details.tbody', compact('loc'));
}
This is my ajax
success:function(data)
{
console.log(data);
$('#results').html(data);
},
everything works fine. but pagination is the only problem
see i have given pagination in the view file..
Kindly help me this
it sorts correctly, but when i click page 2 then the page is reloaded so once again i need to search..
When i click page 2 page is refereshed how to solve this??
Please or to participate in this conversation.