This javascript code works, but it will repeat the entire database rather than stopping at the last row. I\'m new to JS so I don\'t understand why. I\'m using Laravel 8.