fully functioning ajax controller