title: Update javascript content on website to allow dynamical javascript insertion
body: <p>I am inserting content into my website dynamically using javascript. The inserted content includes a datetime objects of the format   </p>
  
  <pre><code>{{ moment(job.posting_date).fromNow() }}
  </code></pre>
  
  <p>using flask-moment. However, this date does not get displayed? If I refresh the site it gets displayed, just the dynamical insertion does not seem to process the moment function? How can I tell the website to update all javascript content?
  thanks
  carl</p>
  
  <p>EDIT:
  Here is how I insert the code in my page. Depending on what the user selects I use ajax</p>
  
  <pre><code>$.ajax({
      url: "{{ url_for('job_market') }}",
      type: "POST",  
      async: true,
      cache: false,
      dataType: 'json',
      contentType: "application/json; charset=utf-8",
      data: JSON.stringify({ stuff: stuff }, null, '\t'),
      success: function(data) {
          if(data.success){
              job_table.innerHTML = data.html;
          }
          else{
              console.log("Error = ", data.error);
          }
      }
   }); 
  </code></pre>
  
  <p>within flask I do something like this </p>
  
  <pre><code>@app.route('/job_market', methods=['GET', 'POST'])
  def job_market(page=1):
  
      if request.method == 'POST':
          ...
          // get the user selection from json
          // access the necessary parts in the database (job)
          ....
          html = render_template('/job_table.html', job=job)
          // send that information back
          return json.dumps({'success': success, 'html': html}), 200,  {'ContentType':'application/json'}
  </code></pre>
  
  <p>EDIT: This is how I include moment.js</p>
  
  <pre><code>from flask_moment import Moment
  moment = Moment()
  moment.init_app(app)
  </code></pre>