How to filter data using ajax in Laravel From Single Table?
Hi,
I have a (listings) table in my database, and it's belongsTo (properties) table. Now i want to filter data from this (listings) table, please let me know how i can filter data using AJAX.
This is my Propertcontroller.php file
public function searchProperty(Request $r)
{
$trans=$r->transType;
$list=Listing::where('lstId', '>', 30)->orWhere('transaction_type', 'Resale')->get();
dd($list);
return view('listings', compact('list'));
}
Have you tried to do an ajax call? I don't see anything that you have tried so far.
In general, the ajax call just returns the data or the HTML you want to replace in the current table. So it can be a blade partial that is being parsed with the given data.
Also, you say you want to do an ajax call. Is that necessary for the table? Maybe just a reload with the search criteria also works ;)