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

224
Views
Get Notification data in laravel using ajax

I have a notification set in laravel and it worked fine, and when I click the notification I want to show a dynamic modal with the notification detail in it, but I couldn't figure how to get each data from the data column

Image

here is my code

Javascript

    $('.detail-btn').click(function() {
        const id = $(this).attr('data-id');
        console.log(id)
        $.ajax({
            url: '/admin/notification/' + id,
            type: 'GET',
            data: {
                'id': id,
            },
            success: function(data) {
                console.log(data);
                $('#judul').html(data.id);
                $('#detail').html(data.data)
            }
        });
    });```


about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

Your "data" variable is a json array. Currently, you're outputting the whole array in your modal. So if you want to display a specific attribute from that array, you can simply change:

$('#detail').html(data.data)

to

$('#detail').html(data.data.name)

Or whichever other attribute you want to display in your modal.

about 4 years ago · Juan Pablo Isaza Report
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!