moved ajax script error function to class