title: How to write a AJAX GET request with two parameters taken from html file?
body: <p>I have the following HTML elements whose values I need to INSERT to a database.</p>
  
  <pre><code>&lt;p&gt;You scored :: &lt;/p&gt;&lt;p id="txtScore1"&gt;&lt;/p&gt;
  &lt;input type="text" placeholder="Your Name" id="name"&gt;
  </code></pre>
  
  <p>This is the sample javascript code suggested at W3schools site to get the task done.</p>
  
  <pre><code>xmlhttp.open("GET","demo_get2.asp?fname=Henry&amp;lname=Ford",true);
  xmlhttp.send();
  </code></pre>
  
  <p>So I tried the following lines in my javascript file:</p>
  
  <pre><code>xmlhttp.open("GET","insert.php?q=&amp;name=" + encodeURIComponent(document.getElementById('name').value + "&amp;txtScore1=" + encodeURIComponent(document.getElementById('txtScore1').innerHTML),true);
  xmlhttp.send();
  </code></pre>
  
  <p>It doesn't work and in chrome console the error is given as <strong>Uncaught Syntax Error. Unexpected Identifier (repeated two times).</strong></p>
  
  <p>Can you please suggest the error I'm doing?</p>