Add Javascript routing and AJAX error handling

Adds Javascript routing in data retrieval so that future changes to URLs (like #48) are easier to make.