translates to 'for the joke'Joci causa
You are correct that 'j' was used to replace the 'i' in certain original latin text, for example the latin for Jesus is correctly 'Iesus'. It is unclear at what stage ancient latin adopted the letter 'j', whether it was 'always there' or indeed if it was a slow evolution of 'i' for certain syntax.
All languages evolve, even ancient ones, but according to Chambers (at least) they agree that joke is from the Latin 'joci'.