Moved clear data inside ajax call to retain local storage data.