title: Uncaught SyntaxError: Unexpected token ILLEGAL (PHP & Javascript)
body: <p>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.</p>
  
  <p>I have singled the precise bit that induces the error, code below.</p>
  
  <p><strong>PHP</strong></p>
  
  <pre><code>printf("&lt;td&gt;&lt;button class=\"btn btn-primary btn-mini\" onclick=\"viewservice(%s)\"&gt;View&lt;/button&gt;&lt;/td&gt;",$RadAcct_List_Obj-&gt;User_List[$i]['USERNAME']);
  </code></pre>
  
  <p><strong>Javascript</strong></p>
  
  <pre><code>function viewservice(n)
  {
      alert(n);
  }
  </code></pre>
  
  <p>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</p>
  
  <pre><code>printf("&lt;td&gt;&lt;button class=\"btn btn-primary btn-mini\" onclick=\"viewservice()\"&gt;View&lt;/button&gt;&lt;/td&gt;");
  </code></pre>
  
  <p>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.</p>
  
  <pre><code>printf("&lt;td&gt;%s&lt;/td&gt;",$RadAcct_List_Obj-&gt;User_List[$i]['USERNAME']);
  </code></pre>