Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

225
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda