refactored ajax code
using the new send method for ajax requests