// For those who come after, put a space after echo.
echo
// put type into your script tag. Be kind to the older browsers.
'<script type="text/javascript">'.
// are you sure jQuery has loaded at this point? Does `$` reference jQuery
// or is there another framework that's nastying up $? (Liferay? Prototype?)
'$.get("fxn.php", '.
// I always prefer explicit casting, but is this defined?
'{ r: ""+result, id:""+'
// is $id a string? Then you need to quote it.
.$id.' } ).'.
// not necessary, but good practice, use the third parameter of `$.get`
// instead of defining it externally.
'success(function() { alert("FXN"); });</script>';
Proposed alternate:
echo '<script type="text/javascript">
$.get("fxn.php", { r: String(result), id:"'.$id.'" }, function() {
alert("FXN");
});
</script>';
Oh, and are you sure that PHP is returning anything? What happens if you use get manually on fxn.php?
id: "' . $id . '"