Understanding Ajax with javascript function.