title: How to submit all sessionStorage content to PHP server
body: <p>I am currently working with something like the below but I'm having trouble with syntax in assigning all of my sessionStorage data to a variable and passing that through to my PHP:</p>
  
  <pre><code>var exampleValueOne = "Value A";
  var exampleValueTwo = 2;
  var exampleValueThree = "Value XYZ";
  
  //Example value from my HTML modal where multiple of the same 'users' may be captured
  var dropDownValue = $('#aDropDown').find('option:selected').attr('value');
  
  //Some assignments
  sessionStorage.setItem("valueA", exampleValueOne );
  sessionStorage.setItem("valueB", exampleValueTwo );
  sessionStorage.setItem("valueC", exampleValueThree );
  
  //Need to be able to assign an indeterminate amount of valueD key value pairs
  if (sessionStorage.getItem("valueD1") === null) {   
  
      var countNumber = 1;           
      sessionStorage.setItem("valueE", countNumber);
  
      for (var i = 0; i &lt; countNumber; i++){  
  
      sessionStorage.setItem("valueD"+[countNumber], dropDownValue);
  
      }
  
  } else {
  
      //if at least one valueD exists it means we need to add after the last one  
      var countNumber = parseInt(sessionStorage.getItem("valueE"));  
      //update the count
      sessionStorage.setItem("valueE", (countNumber + 1));
  
      for (var i = countNumber; i &lt; (countNumber + 1); i++){
  
          sessionStorage.setItem("valueD"+[countNumber], dropDownValue);
  
      }
  
  }
  </code></pre>
  
  <blockquote>
    <p>sessionStorage should look as follows after the above:</p>
    
    <p>valueA: "Value A" </p>
    
    <p>valueB: "2" </p>
    
    <p>valueC: "Value XYZ"</p>
    
    <p>Assuming two values have been saved using for loop they would be save as
    such (value 8 and 2 are just random example attribute values from the html side):</p>
    
    <p>valueD1: "8" </p>
    
    <p>valueD2: "2"</p>
  </blockquote>
  
  <pre><code>//NOW I would like to pass these values to my PHP using Ajax
  
  var data = {
              /*ALL SESSION STORAGE ITEMS?*/
              };                                                             
  
              $.ajax({
                  type: "POST",
                  url: "myPHP.php",
                  data: data,
                  success: function(){                    
                  return false;
                  }
                  });
  </code></pre>