Ajax validation in Magento

I am a beginner Magento developer and recently I have received an interesting task where I had to create a custom address attribute for the customers and add a field with this to the customer’s edit address page and Magento one page checkout. Moreover, the information inserted in that field should be automatically compared with the existing values to avoid the repeating, without page reloading.