adding check for ajax