Rewritten ajax request, functions added, JSON responses