title: AJAX call is broken, NodeJS, Express, Handlebars
body: <p>I've been working on this for a couple of days. I'm certain its something really stupid, but I'm at the end of my sanity.</p>
  <p>The public files are set up properly.</p>
  <p>Error Message:</p>
  <pre><code>Uncaught ReferenceError: togDefine is not defined
  </code></pre>
  <p>Front End HTML:</p>
  <pre><code>&lt;li class=&quot;list-group-item list-group-item-dark&quot;&gt;
     &lt;div class=&quot;row&quot;&gt;
       &lt;div class=&quot;col-md-4&quot;&gt;&lt;strong&gt;Heating:&lt;/strong&gt; {{#if heating}} {{this.heating}} {{else}} N/A {{/if}}&lt;/div&gt;
       &lt;div class=&quot;col-md-4&quot;&gt;&lt;strong&gt;Cooling:&lt;/strong&gt; {{#if cooling}} {{this.cooling}} {{else}} N/A {{/if}}&lt;/div&gt;
       &lt;div class=&quot;col-md-4&quot;&gt;
         &lt;input type=&quot;checkbox&quot; id=&quot;pvt{{this.id}}&quot; checked=&quot;{{this.private}}&quot; onchange=&quot;togDefine({{this.id}}, {{this.private}});&quot; data-toggle=&quot;toggle&quot; data-on=&quot;Private&quot; data-off=&quot;Public&quot; data-onstyle=&quot;success&quot; data-offstyle=&quot;danger&quot; /&gt;
       &lt;/div&gt;
     &lt;/div&gt;
  </code></pre>
  </li>
  <p>AJAX Call:</p>
  <pre><code>$(function() {
  
  //  Private-Public toggle
  let togDefine = (id, pvt) =&gt; {
    $.ajax({
      type: &quot;POST&quot;,
      url: &quot;/api/pvtToggle&quot;,
      data: {
        id: id,
        newState: (pvt === 'true') ? false : true
      },
      success: function(text) {
        if (text === 'ok') {
          pvtSuccess(id, pvt);
        } else {
          console.log('updatePvt failed');
        }
      }
    });
  
  };
  
  
  let pvtSuccess = (id, pvt) =&gt; {
    $('#pvt' + id).attr('checked', (pvt === 'true') ? 'false' : 'true');
  };
  
  
  });
  </code></pre>
  <p>Back End:</p>
  <pre><code>//TOGGLE Private vs Public PROPERTY
  app.put('/api/pvtToggle/', isAuthenticated, function(request, response) {
    db.Prop.update({
      private: request.params.newState
    }, {
      where: {
        id: request.params.id
      }
    }).then(data =&gt; {
      response.send('ok');
    }).catch(error =&gt; {
      console.log(error);
    });
  
  });
  </code></pre>
  <p>Please help me figure out why the request isn't working properly. :D</p>