Does the word "ticket" have a special meaning?

A: "Finally he agreed with my idea."
B: "That's the ticket.!"

Would you please explain the meaning of this sentence for me? [:^)]
I don't understand this phrase.....!!
Hi Candy.
Sorry, I do not know the origin of this phrase, but it means 'that is what is needed' or 'that's right'.
Maybe someone can help with the origin.
Cheers Emotion: smile
it has a metaphoric feel to it - tickets giving you the means to travel / progress?
Teachers: We supply a list of EFL job vacancies
Ah, now I understand. Thanks for your help. Emotion: smile
 suzi's reply was promoted to an answer.
Students: We have free audio pronunciation exercises.
Suzi, you are so good at metaphors! Could you explain this last one a bit further, I don't think I get it in the above-mentioned context?
Possibly, or maybe related to gambling ... 'That is the winning ticket' ... I'm only guessing here Emotion: smile