title: Parse.com save objects in a loop only saving the last object
body: <p>I have the following code to save multiple objects to my parse.com table.
  I have debugged my code and everything should be working properly.
  This code is saving n objects all with the same information as the last object. The images are being save correctly.</p>
  
  <p>Images and captions are just two arrays with the same length.</p>
  
  <p>I am thinking the problem is because I have to wait for the callback from the previous save or the php code to finish. I am changing the image base on the fly as well.</p>
  
  <p>I saw very similar problems posted but I tried the solution and it did not work:
  <a href="https://stackoverflow.com/questions/24591826/parse-com-save-object-once">Parse.com save object once</a>
  and here
  <a href="https://stackoverflow.com/questions/26368957/only-first-object-getting-saved-in-javascript-for-loop">only first object getting saved in javascript for loop</a></p>
  
  <p>Any idea what I am doing wrong here?</p>
  
  <pre><code>for(i = 0; i &lt; images.length; i++){
  
              var caption = convert(captions[i]);
  
              //change image to base64
              $.post("base64.php", {base64: images[i]}, function(data){
  
                  var image = data;
  
                  var post = new Post();
  
                  post.set("post", id);
                  post.set("number", i + 1);
                  post.set("by", by);
                  post.set("title", title);
                  post.set("description", description);
                  post.set("caption", caption);
                  post.set("views", 0);
                  post.set("type", "image");
  
                  var parseImage = new Parse.File("image.png", {base64: image});
                  post.set("image", parseImage);
  
                  post.save(null, {
                      success: function(messages) {
  
                      },error: function(messages, error) {
  
                      }
                  });
  
  
              });
          }
  </code></pre>