title: How can I store JavaScript variable values in a JSON file?
body: <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  
  &lt;head&gt;
    &lt;script&gt;
      function loginButtonClick() {
        var Refresh = document.forms.form1.refresh.value;
        alert(Refresh);
  
        var Area = document.forms.form1.area.value;
        alert(Ticks);
      }
    &lt;/script&gt;
  &lt;/head&gt;
  
  &lt;body&gt;
    &lt;form id="form1"&gt;
      Refresh:
      &lt;br&gt;
      &lt;input id="refresh" type="number" name="Refresh" value=""&gt;
      &lt;br&gt;
      &lt;br&gt; area:
  
      &lt;br&gt;
      &lt;input id="area" type="number" name="area1" value=""&gt;
      &lt;br&gt;
      &lt;br&gt;
  
      &lt;input type="submit" value="Submit" onclick="loginButtonClick()"&gt;
  
    &lt;/form&gt;
  &lt;/body&gt;
  </code></pre>
  
  <p></p>
  
  <p>How can I save the <code>Refresh</code> and <code>Area</code> values to a JSON file as an array with the following format?</p>
  
  <pre><code> data = '[{"Refresh" : 100, "area": 10}]';
  </code></pre>