client ajax updated with better error handling