Finally debugged AJAX - backend logic and communication seem to be completely working