Added ajax validation

needs improvement