title: Vue error: In strict mode code, functions can only be declared at top level or inside a block
body: <p>I'm running a <strong>Vue</strong> script with a text box and submit button, I'm calling an api to POST what I write in the textbox to the api and to return information back from the API, I'm getting this error mentioned in the title eventhough I've written the Javascript functions in vue as it should be? </p>
  
  <p>With the script I'm first setting up a new XMLHttpRequest, initiating the header and api key for both GET and POST methods. I've then created 2 functions to get the data from the textbox and send them to the API, then making another button with the other function to send back the data. </p>
  
  <p>I went through this approach because I kept getting a CORS issue and the API needed me to declare an access control origin header, is there anything I've done wrong with this code? Any help would be greatly appreciated </p>
  
  <pre><code>&lt;script&gt;
  export default {
      name: 'ProperForm'
  }
      methods: {
          StartClient: function () {
              this.get = function(Url, Callback){
              var aHttpRequest = new XMLHttpRequest();
              aHttpRequest.onreadystatechange = function() {
                  if (aHttpRequest.readyState == 4 &amp;&amp; aHttpRequest.status == 200)
                  Callback(aHttpRequest.responseText);
              }
  
              aHttpRequest.open("GET", Url, true);
              aHttpRequest.setRequestHeader("X-Api-Key", "eVnbxBPfn01kuoJIdfgi46TiYNv8AIip1r3WbjsX");
              aHttpRequest.send(null);
          }
          this.post = function(Url, message, Callback) {
              var aHttpRequest = new XMLHttpRequest();
              aHttpRequest.onreadystatechange = function() {
                  if (aHttpRequest.readyState == 4 &amp;&amp; aHttpRequest.status == 200)
                  Callback(aHttpRequest.responseText);
              }
  
              aHttpRequest.open("POST", Url, true);
              aHttpRequest.setRequestHeader("x-api-key", "eVnbxBPfn01kuoJIdfgi46TiYNv8AIip1r3WbjsX");
              aHttpRequest.send(message);
              }
          }
      var client = new StartClient();
  
      submitData: function () {
          document.getElementById('inputBox').disabled = true;
          var targetInputButton = document.getElementById("inputBox").value;
          var message = '{"targetInputButton":"' + targetInputButton + '"}';
          client.post('https://le75bkfcmg.execute-api.eu-west-2.amazonaws.com/dev/start-trace', message, function(response) {
          document.getElementById('jobId').innerHTML = response;
      });
      }
  
      sendBackData: function () {
          var jobId = document.getElementById("jobId").innerHTML;
          var message = '{"jobId":"' + jobId + '"}';
          client.post('https://le75bkfcmg.execute-api.eu-west-2.amazonaws.com/dev/check-trace', message, function(response) {
          document.getElementById('report').innerHTML = response;
      });
      }
  }
  
  &lt;/script&gt;
  </code></pre>
  
  <p><strong>New way I wrote var client:</strong></p>
  
  <pre><code>StartClient: function () {
      var client 
  },
  </code></pre>