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

101
Views
Echo value from pivot table via Ajax larvel

I have an issue that I can't solve.

In laravel I use this code to get a value from a pivot table.

@foreach($data->product as $product)
 <p>{{ $product->pivot->name }}</p>
@endforeach

And i thought I could do the same with jquery, ajax but it does not work. How do I do this?

function getTable() {
     $.ajax({
        type: "GET",
        url: "/product/table",
        datatype: "json",
        success: function (response) {
             $('#table').html("");
             $.each(response.data.product, function (key, product){
                 $('#table').append(
            '<p>' + product.pivot.name + '</p>'
         );
       }); 
      }
  }); 
}
over 4 years ago · Santiago Trujillo
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!