I believe you need to trim() the return data. I tested it out and curl was pushing in a newline character after the url, so the js was being output like:
var site = "http://j.mp/bMSmZV
";
Update the return from your function to be
return trim($data);
and you should be good to go.