Updated ajax functionality.