On behalf of his mother, a young scholar named Liang Yicang from the city of Yangzhou travels to another province to visits his aunt on her birthday. After the birthday celebration, he takes a tour of his aunt's garden and meets Yang Yaoxian, a general's daughter who is also attending the party. He falls in love at first sight, and follows her to learn her address. He spends many sleepless nights thinking of her, and eventually rents a place near her home, hoping for an opportunity to see her again.
One day, he sees the girl's maid posting a poem on the wall in their garden. He likes the poem very much, and immediately writes a poem in response. He realizes that the poem has been composed by Yang Yaoxian and, with the help of the maid, he writes poems on a branch of flowers and sends the flowers to Yang Yaoxian. She admires his talent and falls in love with him. During the Mid-Autumn Festival, they make a vow under the moon to marry and love one another forever.
Back home, Liang Yicang's father has accepted a proposal from his friend, a government official, and has agreed to a marriage between the two families. He asks his son to return home to prepare for the wedding. Liang Yicang returns home, but refuses to agree to the marriage, telling his father that he is already in love and has betrothed himself to Yang Yaoxian. His father flies into a rage and denounces his son.
Yang Yaoxian has meanwhile learned that Liang Yicang has returned home for his marriage, and worries about their relationship. She tears his flowers and poem into pieces and moves to the capital city with her father. Liang Yicang is thrown out of his house by his father, because he refuses to give in. He returns to Yang Yaoxian's home, only to find an empty mansion. He has no money and no place to go, and is compelled to beg on the street. Luckily, he meets his cousin who is on his way to the capital for the civil service exam, and decides to go with him.
In the capital, Liang Yicang earns the title of top scholar in the imperial examination, and is appointed county magistrate in a border province. Before he leaves, he manages to find Yang Yaoxian and reveals the truth. The couple reconciles, but must soon part again. Later, there is rioting along the border, and Yang Yaoxian hears persistent rumours of her beloved's death in battle. His father also hears the rumours and comes to the capital, worried about his son. Liang Yicang finally returns home with great honour, and his father accepts his son's marriage.