Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

j_watson's avatar

append() not working

I have a live search and am trying to append the results to the table using a Laravel partial blade but it's not rendering at all. All ideas are welcome.

js

    $('body').on('keyup','#search-patients',function()
    {
        var keyword = $(this).val();

        $.ajax({
            type: "POST",
            url: "{{ route('searchPatients')}}",
            dataType: "json",
            data: {keyword: keyword,
                    _token: '{{csrf_token()}}'
            },
            success: function(res){
                    $('#dynamic-row').empty();
                    $('#dynamic-row').append(res);

                }
        });
    });
```		
partial blade

@foreach ($patient_admissions as $patient_admission)

table

<tbody id="dynamic-row" style="font-size:13px; vertical-align:middle">
</tbody>
0 likes
3 replies
amitsolanki24_'s avatar

Try this


$('#dynamic-row').html(res);

Instead of

$('#dynamic-row').empty();
$('#dynamic-row').append(res);

yaojinhui's avatar

Does the request and response correct? You can console.log(res) is success callback

Please or to participate in this conversation.