ajax call terminating function updated