title: How to send data to json file using jquery/ajax
body: <p>I have found countless tutorials on how to retrieve data from json files using jQuery and ajax but none on how to <strong>POST data to a json file</strong>. If some one could show me or send me a small script on how to do this that would be great. I have searched everywhere on how to do this and have had no luck. I have seen examples of people doing it but they seem to forget to share important info that i am not seeing.I have no problem retrieving data json files using ajax.
  If someone could tell me if i am forgetting something or doing something wrong that would be great.
  I would be very appreciative if someone could send me a working file so that i can reverse engineer ir and understand how to do it.
  I am wanting to send the values from $firstName and $caption to the json file.
  I know this may seem stupid to others but i am tired of all the searching and not getting any straight answers. </p>
  
  <p>Here is what i have.</p>
  
  <pre><code>      getImages: function(){
          var $firstName = $(".name"),
              $caption = $(".caption");
          var object = {
              name: $firstName.val(),
              caption: $caption.val()
          }
          $.ajax({
              type: 'POST',
              data: object,
              url: 'images.json',
              success: function(data){
                  console.log("KILLER");
                  var count = 0;
                  $.each(data, function(i, imgSlide){
                      count ++;
                      //console.log(result.sliderImages[i].url[0].thumb);
                      var imageEl = "&lt;img src='"+imgSlide.url[0].thumb+"' alt='"+imgSlide.name+"'&gt;";
                      var slide = "&lt;li class='imageSlide' data-id='"+count+"'&gt;"+imageEl+"&lt;/li&gt;";
                      $("ul.imageGallery").append(slide).fadeIn();
                  });
              },
              error: function(){
                  console.log("Abort");
              },
              timeout: 3000,
              beforeSend: function(){
  
              },
              complete: function(){
  
              }
          });
  
      }
  </code></pre>
  
  <p>and here is my JSON file</p>
  
  <pre><code>    [{
        "name": "Bootcamp",
        "url": [{
          "thumb": "img/ill-bootcamp.jpg",
          "med": "img/ill-bootcamp.jpg",
          "large": "img/ill-bootcamp.jpg"
              }],
        "caption": "Lifetime Fitness",
        "ID": ""
       },
       {
         "name": "Pinup Girl",
         "url": [{
              "thumb": "img/ill-pinup.jpg",
              "med": "img/ill-pinup.jpg",
              "large": "img/ill-pinup.jpg"
               }],
        "caption": "Illustration",
        "ID": ""
       },
       {
         "name": "SixDitch",
         "url": [{
               "thumb": "img/web-sixditch.jpg",
               "med": "img/web-sixditch.jpg",
               "large": "img/web-sixditch.jpg"
               }],
         "caption": "SD MotorSports",
         "ID": ""
       }]
  </code></pre>