I've looked a bit into this error and it seems that a majority of people with a similar question end up being the victim of invisible characters. However, I've taken out any white space and retyped the code by hand and I'm still getting this error.
I have singled the precise bit that induces the error, code below.
PHP
printf("<td><button class=\"btn btn-primary btn-mini\" onclick=\"viewservice(%s)\">View</button></td>",$RadAcct_List_Obj->User_List[$i]['USERNAME']);
Javascript
function viewservice(n)
{
alert(n);
}
This results in the Uncaught SyntaxError. However, if I remove the %s placeholder and the call at the end, and leave it as just this
printf("<td><button class=\"btn btn-primary btn-mini\" onclick=\"viewservice()\">View</button></td>");
Then it works fine. I don't understand why it's failing here, a few lines above this I am using similar code (below) and it's working fine.
printf("<td>%s</td>",$RadAcct_List_Obj->User_List[$i]['USERNAME']);