title: Display dynamic webpage content based on URL parameter (Parse Cloud, Express, ejs)
body: <p>I'm new to programming and for this project I'm building a web app using Parse.com Cloud Code and Express. The structure looks like this:<br></p>
  
  <ul>
  <li>app.js (Express related codes)<br></li>
  <li>views/hello.ejs (template)<br></li>
  <li>main.js (cloud functions)</li>
  </ul>
  
  <p>I also have an iOS app that can post a link on Facebook that looks like this: <code>myapp.parseapp.com/hello?objectid</code>. When Facebook users click that link and get redirected to the web app, the web app will automatically <code>res.render</code> the template based on the provided <code>objectid</code>. The <code>objectid</code> is then used to get some data, which will be displayed on the page, from a Parse class using Parse.Query, but my obstacle is not about Parse.Query.</p>
  
  <p>To check if <code>objectid</code> is successfully captured by the server, I tried the following codes to render the template and insert the <code>objectid</code> into the placeholder for the <code>text</code> variable, but the <code>put objectid here</code> is not changed to the provided <code>objectid</code> when page is loaded. Can anyone tell me what went wrong, or if I should do this in another approach?<BR></p>
  
  <p><code>hello.ejs (template):</code></p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
    &lt;head&gt;
      &lt;title&gt;My Web App&lt;/title&gt;
      &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"&gt;&lt;/script&gt;
      &lt;script type="text/javascript"&gt;
          $.post('/hello', {oid: window.location.toString().split("?")[1]});
      &lt;/script&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;p&gt;&lt;%= text %&gt;&lt;/p&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><code>app.js (express):</code></p>
  
  <pre><code>// Initialize Express in Cloud Code.
  var express = require('express');
  var app = express();
  
  // Global app configuration section
  app.set('views', 'cloud/views');  // Specify the folder to find templates
  app.set('view engine', 'ejs');    // Set the template engine
  app.use(express.bodyParser());    // Middleware for reading request body
  
  // Render view
  app.get('/hello', function(req, res) {
      res.render('hello', { text: 'put objectid here' });
  });
  
  app.post('/hello', function(req, res) {
      res.render('hello', { text: req.body.oid });
  });
  
  app.listen();
  </code></pre>