function to create ajax object