How to retrieve data from database using ajax and use that data in a javascript file?

Hello everyone, I am using SugarCRM CE 6.5.X version. I am add some more password validation in modules/Users/PasswordRequirementBox.js file. Now in that file, I want to access data of current user. I am confused here that how to get current users id and name in this file. And I want to use that id and name of current user to retrieve data from database. I know that it should be done using ajax. But I am a newbie in AJAX and I even don't know whether I can use ajax in PasswordRequirementBox.js file and perform queries on database. Please guide me on this. Thank you.