"toilet," 1932, probably from jakes, used for "toilet" since 15c. Meaning "prostitute's customer" is from 1911, probably from the common, and thus anonymous, name by which they identified themselves. Meaning "policeman" is by 1901, from shortening of johndarm (1823), a jocular Englishing of gendarme.
"John Darm! who's he?" "What, don't you know!
In Paris he is all the go;
Like money here,--he's every thing;
A demigod--at least a king!
You cannot fight, you cannot drink,
Nor have a spree, nor hardly think,
For fear you should create a charm,
To conjure up the fiend John Darm!
["John Darm," in "Varieties in Verse," John Ogden, London, 1823]