Adds correct return value to AJAX request and handles it with correct redirect