.js function stops (loop)

Do you get any errors when you inspect the network tab? The code you provided does not contain any obvious errors so I am wondering if all the requests are being made and returned successfully.