Loading blog when reaching the end of the page

Web Programming
Job 14 of 23
I developed an algorithm in PHP + JS which, upon reaching the end of the page, downloads the following blog entries, and if the user came in from a mobile device, 2 entries are downloaded, and if from a PC, then 4 entries.