title: Adding Objects to JSON file with JQuery
body: <p>I have a very simple JSON file called json.php:</p>
  
  <pre><code>[ { "name":"wowsk" } ]
  </code></pre>
  
  <p>I want visitors to my website to be able to add objects to the array. What I am stuck on though is, how to allow them to add it. I have an HTML file and the body looks like this:</p>
  
  <pre><code>&lt;form id="addName"&gt;
      &lt;input id="name" placeholder="Enter your name."&gt;
      &lt;button id="addNameButton" type="submit"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  &lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"&gt;&lt;/script&gt;
  &lt;script&gt;
      function addName() {
          var input=document.getElementById("name").value;
          $.ajax({
          url: "json.php",
          type: 'POST',
          data:  {"name":"hello"}
      })
  }
  $("#addNameButton").click(function() {addName()}) 
  &lt;/script&gt;
  </code></pre>
  
  <p>The page will not add another object to the file though, and I have also tried  using PUT but that does not work either. Will I not be able to use JQuery to add objects to the file or do I just have a mistake in using the function? I have researched this for multiple days but could not find anything to help.<br><br> Thanks for any help,<br>Wowsk<br> <br>Also, as a note, I want the file to be changed for others too not just you or your session.</p>