title: Transferring the correct value to my json
body: <p>I have this function, which displays the items that the user has added to their cart. </p>
  
  <pre><code>function _getmycart(arr) {
  
    for (var i = 0; i &lt; arr.length; i++) {
      var t;
  
      t = "&lt;div class='items'&gt;&lt;img src='" + serverURL() + "/images/" +
        arr[i].itemImage + "' class='image'&gt;&lt;div class='deletebtn' 
      id = 'deletebtn"+ arr[i].itemID +"' &gt; &lt; input type = 'image'
      src = 'images/deletebtn.jpg'
      class = 'deletebtn' &gt; &lt; /div&gt;&lt;div 
      class = 'itemName' &gt; &lt; b &gt; "+arr[i].itemName+" &lt; /b&gt;&lt;/div &gt; &lt; div
      class = 'itemID' &gt; Item ID: " +arr[i].itemID+" &lt; /div&gt;&lt;div 
      class = 'itemSize' &gt; &lt; b &gt; "+ arr[i].itemSize+" &lt; /b&gt;&lt;/div &gt; &lt; div
      class = 'itemPrice' &gt; $ "+ arr[i].itemPrice +" &lt; /div&gt;&lt;/div &gt; "
  
      $('#mycartitems').append(t);
  
      const sum = arr.reduce((acc, el) =&gt; acc + Number(el.itemPrice), 0);
      $('#totals').html("Total S$" + sum);
  
      $('#deletebtn' + arr[i].itemID).bind("click", {
          id: arr[i].itemID
        },
        function(event) {
          var data = event.data;
          deleteitem(data.id);
        });
  
    }
  }
  </code></pre>
  
  <p>and i'm using this to send the <code>itemID</code> and <code>email</code> to my php.</p>
  
  <pre><code>function deleteitem(itemID) {
  
    var url = serverURL() + "/deletemycartitems.php";
    var email = localStorage.getItem("email");
    var JSONObject = {
      "email": email,
      "itemID": itemID,
  
  
    };
  
    $.ajax({
      url: url,
      type: 'GET',
      data: JSONObject,
      dataType: 'json',
      contentType: "application/json; charset=utf-8",
      success: function(arr) {
        _getmycart(arr);
      },
      error: function() {
        alert("Failed");
      }
  
    });
  
  }
  </code></pre>
  
  <p>I cant seem to get the correct itemID, where did i go wrong?</p>