The answer is "it is an example of avoidance learning".
Avoidance learning refers to the procedure by which an individual takes in a conduct or reaction to keep away from a distressing or disagreeable circumstance. The conduct is to maintain a strategic distance from, or to expel oneself from, the circumstance.Like in the given situation, after taking aspirin, headache of a person go away, now he knew that whenever he will suffer from headache he will take aspirin.