added error flag in ajax request, error is hitting