refactor ajax response for relationships