Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

166
Views
Laravel Delete function not working using ajax

Hi im using datatable and need to delete multiple data using checkbox, I'm using post method javascript,

Controller

 public function deleteselected(Request $request){
    $ids = $request->ids;
    Product::whereIn('id', $ids)->delete();
    return response()->json(['code'=>1, 'msg'=>'Products have been deleted from database']); 
 }

Javascript

                       $.post(url,{countries_ids:checkedCountries, _token: "{{ csrf_token() }}", _method: "POST"},function(data){
                          if(data.code == 1){
                              $('#geniustable').DataTable().ajax.reload(null, true);
                              toastr.success(data.msg);
                          }

                       },'json');

Error

{
    "message": "Function () does not exist",
    "exception": "ReflectionException",
    "file": "/var/www/html/lifespace/project/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php",
    "line": 22,
    "trace": [
        {
            "file": "/var/www/html/lifespace/project/vendor/laravel/framework/src/Illuminate/Routing/RouteSignatureParameters.php",
            "line": 22,
            "function": "__construct",
            "class": "ReflectionFunction",
            "type": "->"
        },
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!