Report-a-problem: AJAX deal with html for status 503

currently, if the app returns status 503 on an AJAX (json) call,
nginx intercepts that and replaces the reply with HTML.

This PR:

- change fixes the `report-a-problem` javascript to handle this situation
- moves the `report-a-problem` code to a separate file