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

187
Views
how to use links returning paginate to JSON response in AJAX LARAVEL

How can I use or call $data->links() for pagination. In my scenario, I'm using get request using AJAX JavaScript. It return a JSON Response and I want to call $data->links() using JavaScript.

this is my Controller

public function getOrders($store_id)
{
    $data = DB::table('stores')
    ->where('stores.id',$store_id)
    ->paginate(5);

    return response()->json(['data' => $data]);
}

This is my Get Request AJAX

function fetchOrder(){
    $.ajax({
            type: "GET",
            url: "/get-orders/"+store_id,
            dataType: "json",
            success: function (response) {

                if (response.data.data != null) {
                    console.log(response);
                    $('.OrderTbody').html("");
                    $.each(response.data.data, function (key, item) {
                        $('.OrderTbody').append('<tr><td>' + item.store_name + '</td></tr>');

                    });


                }
            }
        });
}
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!