Some codes for ajax calls