serving JSON to jquery: a head-slap

I hope in some way that this post will help those who made the same stupid mistake I did and wasted way too much time figuring out something that in retrospect is obvious. Sigh.
Hypothetically speaking, if you wanted to make a servejson.php page to serve data in JSON format, it might look something like this:

<?php
$contact = array("name" => "Ben");
$contact_encoded = json_encode($contact);
header('Content-type: text/html');
echo $contact_encoded;
?>

and your showjson.html page to get and show the data might look like this:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.pack.js"></script>
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
$.getJSON('http://servejson.php?callback=?',
function(data){
$("#display").text(data.name);
});
});
</script>
</head>
<body>
<div id="display"></div>
</body>
</html>

So far so good, the code follows the examples you’ve looked at to the letter. But it doesn’t work of course. And it won’t. And it will fail silently, giving you no idea what’s going on. You’ll do some searches and read some forums, and will find nothing on it. Eventually, while reading another person’s frustrated blog entry, it will come to you. And then you will feel dumb for having copied and pasted so much example code without thinking about what you’re doing, and the hot shame of obviousness will cause your hand to hit your head before you’re even aware what’s happening. Your consciousness will swim in the ocean of nothingness and flux. And you will be that much closer to the next life, and you will want the time back.
So please, think. There’s a callback key on the querystring in the jquery code up there. Jquery is going to generate a function name, send it, and want to get it back, etc., etc. DUH. So make your php code:

echo $_GET['callback'] . "(" . $contact_encoded . ")";

…and go back to obsessing about much more important things. Bless us all.