ajax method supports proper handling for ajax errors