title: Express Node JS GET request from HTML
body: <p>I am taking my first jab at Express Node JS and thoroughly enjoying it. I'm looking to understand how to get first name and last name information input by a user to the server and displaying it in the console log.</p>
  
  <p>My code in HTML is as follows:</p>
  
  <pre><code>&lt;form action = "/getname/" method = "GET"&gt; 
      &lt;p&gt;First name: &lt;input type="text" id="fname" name="firstname"&gt;&lt;/p&gt; 
      &lt;p&gt;Last name: &lt;input type="text" id="lname" name="lastname"&gt;&lt;/p&gt;
      &lt;p&gt;&lt;input type="button" value="Submit" id="namebutton" /&gt;&lt;/p&gt;
      &lt;p&gt;&lt;span id="JSONname"&gt;&lt;/span&gt;&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>My code in Express <code>app.js</code> is:</p>
  
  <pre><code>app.get('/getname/', function (req, res) {
      response = {
          firstname: req.query.firstname,
          lastname: req.query.lastname
      };
      console.log(response);
      res.end(JSON.stringify(response));
  })
  </code></pre>
  
  <p>I think the connection between the <strong>localhost:xxxx/getname</strong> and the server is working, however the html to getname isn't working.</p>
  
  <p>Might anyone see where the code is going wrong?</p>