Hi - get all your connection stuff working on your host before trying the AJAX connection.
You should be able to test the scripts by just running the url directly in the browser.
Normally a host will provide example connection scripts for you.
It'll be the same with localhost - you'll still need to connect to the database.