title: Get selected option value in node.js with using express
body: <p>I need to get the selected object using express to console it in app.js</p>
  
  <p>example.html</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code> &lt;form id="tableForm" action="getJson"&gt;
          &lt;select class="example" name="example"&gt;
                &lt;option name="" value="0" selected&gt;Select table&lt;/option&gt;
                &lt;option name="table1" value="1"&gt;Table 1&lt;/option&gt;
                &lt;option name="table2" value="2"&gt;Table 2&lt;/option&gt;
                &lt;option name="table3" value="3"&gt;Table 3&lt;/option&gt;
          &lt;/select&gt;
      &lt;/form&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>App.js</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var express = require('express'),
  app = express();
  
  app.use(express.bodyParser());
  
   app.get('/', function(req, res){
    res.sendfile('views/index.html');
  });
  
  app.get('/getJson', function (req, res) {
     console.log(req.body.example);
  });
  
  app.listen(3000, function(){
      console.log('Server running at port 3000: http://127.0.0.1:3000')
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>The output of the console is undefined even if I select another object.</p>