Submit JQuery array alongside PHP form data to PHP script
<p>I'm dabbling in JQuery, and have run up against an issue I'm not quite able yet to figure out. Here is the context:</p>

<p>I have a HTML form, utilising MySQL &amp; PHP, used to edit a CMS post. This post would have a list of attachments (eg. images for a gallery, or downloadable files). Using JQuery, the user can click on these list item elements and edit the details of each attachment in a revealed div (eg. delete image, add capton, etc).</p>

<p>Currently when the user opts to delete an attachment, I simply fade its opacity and provide a new option to the user to 'undo' the delete. Upon submission of the complete parent form (the CMS post), I want to gather all the attachments still marked for deletion, and submit their GUID's to the PHP script that is doing all the rest of the post updating for me.</p>

<p>Option A:</p>

<p><em>Is it possible to submit a JQuery array to a PHP script alongside the data being sent naturally to the action script by the form inputs?</em></p>

<p>Option B:</p>

<p><em>Is it possible to fill / empty a (hidden) form input array dynamically with JQuery, which could then be submitted naturally to the action script with everything else?</em></p>

<p>I am currently at the stage where I am filling a Javascript array with the necessary GUIDs, but now don't know what to do with it.</p>

<pre><code>//populate deleted attachments array
$(document).ready(function() {
  $('#post-editor').submit(function() {
    var arrDeleted = [];    
    $('.deleted-att').each(function(){
      arrDeleted.push({guid: $(this).attr("data-guid")});
    });
    //do something with array
  });
});
</code></pre>
