When Mamun died, Mu'tasim ascended the throne. He (Mu'tasim), like his Abbasid ancestors, was worried about the leadership of Ahlul-Bayt (A.S.) and their political and scholarly status. Therefore, he exiled Imam al-Javad (A.S.) from Madina to Baghdad in the year 219 A.H., for fear of his popularity and extending his effect.
He did this, in order to draw the Holy Imam near the centre of power and scrutiny and isolate him from practising his popular, political and scholarly role.
Indeed, Imam al-Javad (A.S.) was exiled to Baghdad from Madina and stayed in Baghdad until in the year 220 A.H. when he was martyred by poisoning by his wife Ummul Fadl at the instigation of the ruling Abbasid caliph Mu'tasim.
His short life lasted twenty five years and some months, and was full of historical, ideological and scholarly struggle and achievements.
The Holy Imam (A.S.) was martyred in Baghdad in the year 220 A.H., on the 29th of Zee al-Qa'adah and was burried in the graveyard of Quraish behind his grandfather, Imam Musa bin Jafar (A.S.) the seventh holy Imam which was since then became famous as Kazmain.
source : www.tebyan.net