One is a degree title and the other is a professional post-nominal typically--but certainly not universally--used by practicing attorneys.
A Juris Doctor is a degree awarded to an individual who has completed the necessary coursework required by a School of Law. An Esquire is is the naming utilized by some attorneys to denote that they are in fact an individual who has the ability to practice law. Like Rich stated, Esquire is most commonly utilized in the United States and is most certainly not a universal thing.
Foo foo? Haha. I haven't heard that expression in ages. But seriously folks, the link Kizmet provided is right on the mark.
When I see Esquire used, I immediately think of an English or British accent and one of those old big antique brass phones. I like it if no other reason than it being used to rub it into the faces of people who think using earned titles after your name is "pretentious". Coincidentally, most people I've encountered who think that have earned no titles. Funny how that works...
One of my former professors and current research mentor has her LLB from her native country. She earned her LLM in New York and became a licensed attorney there. She earned her Ph.D. in CJ in Texas where she's a professor. Her signature line reads Ph.D., Esq. The bottom line is that Esq is universal to indicate that your an attorney but the J.D. is not.
In Days Gone By, lawyers weren't permitted to advertise nor were they permitted to use the title "Doctor" or anything else besides "Attorney at Law". The ever-vigilant American Bar Association issued a formal ethics opinion allowing lawyers to use the post-nominal "Esquire" Because, and I quote, "Everybody is an esquire." The title is both meaningless and not misleading.
Kinda wish they hadn't. A world without lawyer advertisements would be a gentler, more peaceful place...
I knew a graphic designer who put "Esq." after his name on his business cards. People would, invariably, ask if he was also an attorney. He was not. He just recognized that it is an unregulated and objectively meaningless designation. Also, he found that this little tidbit inevitably sparked a conversation with whomever he handed his card to which, in turn, would generate some business for him. It was a clever ploy. Traditionally attorneys did not use "JD" as their post-nominal because the JD is a fairly new innovation. It replaced the LL.B. in the U.S. I've noticed younger lawyers tend to use J.D. in favor of the esquire. And I have been keeping a mental tally of lawyers, typically men of a certain age, who insist on being called "Doctor" on the basis of their JD. Only one of them have I confirmed was awarded an LL.B. but his school let him trade it in for a J.D. years after he graduated when they switched over. For folks in that camp, perhaps, they let the new certificate go to their head. To consider another annoyingly renamed professional bachelors degree, see also the PharmD.