The fate of Ahaziah when he went to visit was God’s judgment on him. When Ahaziah arrived at Jezreel, he and Joram met with Jehu son of Nimshi, whom GOD had already authorized to destroy the dynasty of Ahab. Jehu, already at work, executing doom on the dynasty of Ahab, came upon the captains of Judah and Ahaziah’s nephews, part of the Ahaziah delegation, and killed them outright. Then he sent out a search party looking for Ahaziah himself. They found him hiding out in Samaria and hauled him back to Jehu. And Jehu killed him.
They didn’t, though, just leave his body there. Out of respect for his grandfather Jehoshaphat, famous as a sincere seeker after GOD, they gave him a decent burial. But there was no one left in Ahaziah’s family capable of ruling the kingdom.