Error check and ajax test