I'll suggest you host it on Heroku, you can get free hosting if the usage isn't that high, just by confirming your payment method (far as I remember, no idea if they changed it).
Also, the problem of undefined still going with me.
Heroku? Haven't heard about that one. I will have a look into it.
Did you try to refresh with reloading everything, like with SHIFT+F5 or CTRL+F5. This usually clears the cache and reloads the javascript code from the server. Give it a try and let me know if it is still not working.
Yeah, already tried clearing cache, but still have the problem.
Heroku allows you to host your php (any many other projects) online, you won't need to manage the hosting your self as they do most of the work, they also have plugins for DB and other stuff to make it easier for you. You'll have to do some edits for it to work on Heroku I think, but it should be worth it. Specially that if the traffic isn't high you can get it for free.