Refresh webpage on change in folder
Server side:


There's no point in importing os and glob inside the function. Local import is used for very specific cases and this is not one of them.
You're defining newset and then returning newest, did you test your code?
There's no point in defining newest (after fixing the typo), and then returning it in a separate line. Just return it in one line.
Add a space before key=..., as per Python conventions.


Client side:

What you've implemented here isn't very smart. You're constantly asking the server for updates, instead of having the server push updates to you when ever it detects them. You've essentially implemented a REST API, but for the wrong reasons. Take a look at websockets (flask-socketio is pretty good).