codice:
<!doctype html>
<html>
<head>
</head>
<body>
<script>
var first = "2";
document.getElementsByTagName('head')[0].appendChild('<script src="http://****************.it/pagine3.php?category_id=' + first + '"></script>');
</script>
</body>
</html>
Prova cosi.

P.S. Non è che stai tentando di eseguire questo fuori dal tuo dominio vero?