title: $jsonObj data not being passed via ajax and POST on IE(11) only
body: <p>I'm trying to pass data via post with ajax to my sendjs.php. </p>
  
  <p><code>jsonObj</code>    is not being passed in IE11 only (havent tested lower versions of IE but it works in Edge and all other browsers). <code>FormData</code> and <code>captchaResponse</code> are being passed though.</p>
  
  <p>In 'Network' in IE 11 inspector the post data is:</p>
  
  <p><code>cart: [null]</code> and there are no errors displayed in console.</p>
  
  <p>All other browsers it contains the data:</p>
  
  <p>eg. <code>cart: {name: "130 Litre Polypropylene Soakwells", price: "$39.95", quantity: "4", total: "$159.80"},…]</code></p>
  
  <p>Live site here: <a href="http://www.diysoakwells.com.au" rel="noreferrer">www.diysoakwells.com.au</a> (you can add an item and checkout to test).</p>
  
  <p>Have spent ages trying to find the cause and now I'm not even sure where to go from here to be honest, so any information would be appreciated and I will update the post with any info as requested. </p>
  
  <p>app.js</p>
  
  <pre><code>$(function() {
  
  
      // Get the form.
      var form = $("#ajax-contact");
  
      // Get the messages div.
      var formMessages = $("#form-messages");
  
      var spinner = $("#spinner");
  
      var submit = $("#submit");
  
      // Set up an event listener for the contact form.
      $(form).submit(function(e) {
          // Stop the browser from submitting the form.
          e.preventDefault();
  
          //display the cog animation
          $(spinner).removeClass("hidden");
          //hide the submit button
          $(submit).addClass("hidden");
  
  
  
          var jsonObj=[];
          for(i=1;i&lt;$(".item-price").length;i++)
          {
              var items={};
              var itemname = $(".item-name").get(i);
              var itemprice = $(".item-price").get(i);
              var itemquantity = $(".item-quantity").get(i);
              var itemtotal = $(".item-total").get(i);
              items["name"] = itemname.innerHTML;
              items["price"] = itemprice.innerHTML;
              items["quantity"] = itemquantity.innerHTML;
              items["total"] = itemtotal.innerHTML;
              jsonObj.push(items);
  
          }
  
          console.log(jsonObj );
  
          var formdata = {};
          formdata["textbox"] = $("#textbox").val();
          formdata["name"] = $("#name").val();
          formdata["phone"] = $("#phone").val();
          formdata["email"] = $("#email").val();
          formdata["address"] = $("#address").val();
          formdata["grandtotal"] = simpleCart.grandTotal();
  
          var x = 
          {
              "cart" : jsonObj,
              "formdata" : formdata,
              "captchaResponse" : $("#g-recaptcha-response").val()
          };
          //jsonString = jsonObj+formdata;
          var y = JSON.stringify(x);
          console.log(y);
          var result = jQuery.parseJSON(y);
          console.log(result);
  
  
          // Serialize the form data.
          //var formData = $(form).serialize();
  
          // Submit the form using AJAX.
          $.ajax({
              type: "post",
              url: "sendjs.php" ,
              //url: $(form).attr("action"),
              data: y,
              contentType: "application/json; charset=utf-8",
              processData: false,
              success: function (response) {
                          if(response=="Thank You. Your order has been sent and a copy mailed to your inbox.")
                          {
                      //remove the button animation
                      $(spinner).addClass("hidden");
                      $(formMessages).removeClass("error");
                      $(formMessages).addClass("success");
                      $("#textbox").val("");
                      $("#name").val("");
                      $("#email").val("");
                      $("#message").val("");
                      $("#phone").val("");
                      $("#address").val("");
  
                          }
                          else
                          {
                      $(formMessages).removeClass("success");
                      $(formMessages).addClass("error");
                      $(spinner).addClass("hidden");
                      $(submit).removeClass("hidden");
                          }
  
                  $(formMessages).text(response);
  
              }
          });
      });
  
  });
  </code></pre>
  
  <p>sendjs.php</p>
  
  <pre><code>&lt;?php
  //Debugging
  //ini_set( 'display_errors', 1 );
  //error_reporting( E_ALL );
  
  //replaces file_get_contents due to restrictions on server
  function get_data($url)
      {
        $ch = curl_init();
        $timeout = 5;
        curl_setopt($ch,CURLOPT_URL,$url);
        curl_setopt($ch,CURLOPT_RETURNTRANSFER,1);
        curl_setopt($ch,CURLOPT_CONNECTTIMEOUT,$timeout);
        $data = curl_exec($ch);
        curl_close($ch);
        return $data;
      }
  
      //turn url_fopen on due to restrictions on server
      //ini_set('allow_url_fopen', true);
  
      date_default_timezone_set('Australia/Perth');
      $time = date ("h:i A"); 
      $date = date ("l, F jS, Y");
      $json = file_get_contents('php://input');
      $obj = json_decode($json,true);
      $captcha = $obj["captchaResponse"];
      $captcha;
      $secretKey = "scrubbed";
      $ip = $_SERVER['REMOTE_ADDR'];
      $response = get_data("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&amp;response=".$captcha."&amp;remoteip=".$ip);
  
      //not used due to server restictions
      //$response=file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=".$secretKey."&amp;response=".$captcha."&amp;remoteip=".$ip);
  
      $responseKeys = json_decode($response,true);
  
      if(intval($responseKeys["success"]) !== 1) {
          echo "Please Click on the Captcha";
          return false;
      }
      else 
      {
      //echo $items;
      $name = $obj["formdata"]["name"];
      $phone = $obj["formdata"]["phone"];
      $email = $obj["formdata"]["email"];
      $textbox = $obj["formdata"]["textbox"];
      $address = $obj["formdata"]["address"];
      $grandtotal  = $obj["formdata"]["grandtotal"];
      $text = "&lt;html style='font-family:arial'&gt;
      &lt;body&gt;
          &lt;h1 style='color:crimson;'&gt;DIY Soakwells&lt;/h1&gt;
          &lt;p&gt;This order was submitted from www.diysoakwells.com.au on $date at $time&lt;/p&gt;
          &lt;p&gt;$name thank you for your order inquiry. Deliveries are normally every Friday, we will be in contact shortly to discuss your order and confirm a time.&lt;/p&gt;
          &lt;p&gt;An invoice will be issued after delivery for payment via bank transfer.&lt;/p&gt;
          &lt;p&gt;In the meantime if you haven't already seen it, you can take a look at www.soakwellcalculator.com.au to confirm the number of soakwells you ordered will be adequate.&lt;/p&gt;
          &lt;br&gt;
  
          &lt;h2 style='color:crimson;'&gt;CUSTOMER DETAILS&lt;/h2&gt;
          &lt;p&gt;&lt;b&gt;Email:&lt;/b&gt;\n$email&lt;/p&gt;
          &lt;p&gt;&lt;b&gt;Name:&lt;/b&gt;\n$name&lt;/p&gt;
          &lt;p&gt;&lt;b&gt;Phone:&lt;/b&gt;\n$phone&lt;/p&gt;
          &lt;p&gt;&lt;b&gt;Delivery Address:&lt;/b&gt;\n$address&lt;/p&gt;
          &lt;p&gt;&lt;b&gt;Message:&lt;/b&gt;\n$textbox&lt;/p&gt;
          &lt;br&gt;
  
          &lt;h2 style='color:crimson;'&gt;ORDER DETAILS&lt;/h2&gt;";
  
          $items_in_cart = count($obj["cart"]);
          for($i=0; $i &lt; $items_in_cart; $i++) {
              $iname = $obj["cart"][$i]["name"];
              $price = $obj["cart"][$i]["price"]; 
              $quantity = $obj["cart"][$i]["quantity"];
              $total = $obj["cart"][$i]["total"];
              //display looped cart data      
              $items .= "&lt;p&gt;$iname x $quantity - $price &lt;small&gt;ea.&lt;/small&gt; &lt;b&gt;Sub Total: &lt;/b&gt; $total .&lt;/p&gt;";
          }
  
          $final_total ="&lt;br&gt;
          &lt;p&gt;&lt;b&gt;Total: &lt;/b&gt;$$grandtotal &lt;small&gt;inc. GST&lt;/small&gt;&lt;/p&gt;
          &lt;/body&gt;
          &lt;/html&gt;";
  
          //Email Content
          $body = $text.$items.$final_total;
  
          // Set the email subject.
          $subject = "New order from $name";
  
          // Build the email content.
          $email_content = $body;
  
          // Build the email headers.
          $email_headers = 'MIME-Version: 1.0' . PHP_EOL;
          $email_headers .= 'Content-Type: text/html; charset=ISO-8859-1' . PHP_EOL;
          //$email_headers .= 'To:' . $name . '&lt;' . $email . '&gt;' . PHP_EOL;
          $email_headers .= 'From: DIY Soakwells &lt;orders@diysoakwells.com&gt;' . PHP_EOL;
          $email_headers .= 'CC: orders@diysoakwells.com.au' . PHP_EOL;
          $email_headers .= 'Reply-To: DIY Soakwells &lt;orders@diysoakwells.com.au&gt;' . PHP_EOL;
          $email_headers .= 'Return-Path: DIY Soakwells &lt;orders@diysoakwells.com&gt;' . PHP_EOL;
          $email_headers .= 'X-Sender: DIY Soakwells &lt;orders@diysoakwells.com.au' . PHP_EOL;
          $email_headers .= 'X-Mailer: PHP/' . phpversion() . PHP_EOL;
          //$email_headers .= 'X-Priority: 1' . PHP_EOL;
  
  
  
          //validate Email
          $email_check = filter_input(INPUT_POST, $email, FILTER_VALIDATE_EMAIL);
          //Recipients
          $to = $email;
  
          if (mail($to, $subject, $email_content, $email_headers, '-forders@diysoakwells.com.au')) {
              // Set a 200 (okay) response code.
              //http_response_code(200);
              echo "Thank You. Your order has been sent and a copy mailed to your inbox.";
          } else {
              // Set a 500 (internal server error) response code.
              //http_response_code(500);
              echo "There appears to be an issue with our server, please ring 0420 903 950 or email contact@diysoakwells.com.au.";
          }      
      }       
  ?&gt;
  </code></pre>
  
  <p>Hope someone can give me some tips.</p>
  
  <p>Edit: Added cart modal html</p>
  
  <pre><code>&lt;!-- cart modal panel --&gt;               
  &lt;section class="modal fade cartModal" role="dialog" tabindex="-1"&gt;
  
  &lt;div class="modal-dialog" role="document"&gt;
  &lt;div class="modal-content"&gt;
  
  &lt;!-- Modal Header--&gt;                
      &lt;div class="modal-header"&gt;
          &lt;button type="button" class="close" data-dismiss="modal" aria-label="Close"&gt;&lt;span aria-hidden="true"&gt;&amp;times;&lt;/span&gt;&lt;/button&gt;
  
          &lt;h3 class="modal-title cart_summary"&gt;
              &lt;b&gt;Cart Summary&lt;/b&gt;
          &lt;/h3&gt;       
      &lt;/div&gt;
  
  &lt;!-- Cart Modal Body --&gt;
  &lt;section class="modal-body"&gt;
          &lt;div class="checkout"&gt;
  
              &lt;!-- Cart Items --&gt;
              &lt;div class="simpleCart_items"&gt;&lt;/div&gt;
  
                      &lt;!-- Cart Items Footer --&gt;
                  &lt;div class="panel-footer"&gt;
                  &lt;div class="row"&gt;
                      &lt;div class="col-xs-12 col-sm-4 cart_modal_btn"&gt;
                          &lt;a class="btn btn-default btn-sm" onclick="simpleCart.empty();"&gt;Clear Cart&lt;/a&gt;
                      &lt;/div&gt;
                      &lt;div class="col-xs-12 col-sm-8 cart_footer_text"&gt;
                          &lt;span class="total"&gt;Current Total: &amp;nbsp;
                          &lt;b class="simpleCart_grandTotal"&gt;&lt;/b&gt;   
                          &lt;small class=gst&gt;Inc. GST&lt;/small&gt;
                          &lt;/span&gt;
                      &lt;/div&gt;
                  &lt;/div&gt;
              &lt;/div&gt;
          &lt;/div&gt;
  
          &lt;div&gt;
              &lt;h3 class="cart_summary"&gt;           
                  &lt;b&gt;Checkout&lt;/b&gt;
              &lt;/h3&gt;
          &lt;/div&gt;
  
  &lt;!-- Customer Details Form --&gt;
      &lt;section class="details_form"&gt;
          &lt;b class="invoice_info"&gt;Due to the custom nature of this service we do not take payment until your order is confirmed and the materials are delivered.&lt;/b&gt;
  
          &lt;b class="invoice_info"&gt;You will be emailed an invoice with our account details. Payment terms are 5 days from the invoice date please.&lt;/b&gt;
  
          &lt;p class="invoice_info"&gt;For payment we accept bank transfer and VISA / Master Card &lt;small&gt;(2.3% surcharge for credit cards).&lt;/small&gt;&lt;/p&gt;
  
          &lt;form id="ajax-contact" class="contact_form" method="post"&gt; 
              &lt;fieldset&gt;                  
                  &lt;h4 class="contact_form_title"&gt;Questions / Additional Information&lt;/h4&gt;
  
                  &lt;div class="textbox_container"&gt;
                      &lt;textarea rows="5" style="overflow-y:hidden" class="textbox" name="textbox" id="textbox"&gt;&lt;/textarea&gt;
                  &lt;/div&gt;
  
                  &lt;h4 class="contact_form_title"&gt;Customer Details&lt;/h4&gt;    
  
                  &lt;table&gt;
                      &lt;tr&gt;
                          &lt;th&gt;&lt;label for="name" class="cart_label"&gt;Enter Name&lt;/label&gt;&lt;/th&gt;
                          &lt;td&gt;&lt;input type="text" name="name" placeholder="Name Required" class="input" id="name" required /&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;th&gt;&lt;label for="phone" class="cart_label"&gt;Enter Phone Number&lt;/label&gt;&lt;/th&gt;
                          &lt;td&gt;&lt;input type="tel" placeholder="Phone Number Required" name="phone" class="input" id="phone" required/&gt;&lt;/td&gt;             
                      &lt;/tr&gt;
                      &lt;tr&gt;
                          &lt;th&gt;&lt;label for="emaile" class="cart_label"&gt;Enter Email&lt;/label&gt;&lt;/th&gt;
                          &lt;td&gt;&lt;input type="email" placeholder="Email Required" name="emaile" class="input" id="emaile" required/&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                      &lt;tr&gt;                            
                          &lt;th&gt;&lt;label for="address" class="cart_label"&gt;Enter Address&lt;/label&gt;&lt;/th&gt;
                          &lt;td&gt;&lt;input type="text" name="address" placeholder="Address / Suburb" class="input" id="address" required/&gt;&lt;/td&gt;
                      &lt;/tr&gt;
                  &lt;/table&gt;
              &lt;/fieldset&gt;
  
                  &lt;!-- captcha --&gt;
              &lt;div class="captcha_container"&gt;
                  &lt;div class="g-recaptcha" data-sitekey="6LfPjyMTAAAAANe_qucSV5ZFAuDNO4Ud524-NGoa" data-size="compact"&gt;&lt;/div&gt;
              &lt;/div&gt;
  
  
              &lt;section class="fb_container"&gt;
                  &lt;div class="fb-like" data-href="http://www.facebook.com/DiySoakwells" data-layout="button_count" data-width="225" data-action="like" data-show-faces="false" data-share="true"&gt;&lt;/div&gt;
              &lt;/section&gt;
              &lt;br/&gt;&lt;!-- css this --&gt;
  
  
  
              &lt;fieldset class="submit"&gt;
  
                  &lt;div class="formMessages submit_field"&gt;&lt;/div&gt;
  
                  &lt;div id="spinner" class="hidden success submit_field"&gt;&lt;i class="loader2"&gt;&lt;/i&gt;&lt;/div&gt;
  
                  &lt;input id="submit" type="submit" name="Submit" value="Send" style="cursor:pointer" class="success"/&gt;
              &lt;/fieldset&gt;
  
          &lt;/form&gt;
      &lt;/section&gt;
  &lt;/section&gt;      
  
  
  &lt;!-- Modal Footer--&gt;
  &lt;section class="modal-footer"&gt;
          &lt;button type="button" class="btn btn-default close" aria-label="Close" data-dismiss="modal"&gt;Back to Shop&lt;/button&gt;
  &lt;/section&gt;
  
  &lt;/div&gt;&lt;!-- /.modal-content --&gt;
  &lt;/div&gt;&lt;!-- /.modal-dialog --&gt;
  
  &lt;/section&gt;&lt;!-- /.main section --&gt;
  </code></pre>
  
  <p>Simple Cart config</p>
  
  <pre><code>simpleCart({
  //Setting the Cart Columns for the sidebar cart display.
  cartColumns: [
  //{ attr: "image", label: false, view: "image"},
  //Name of the item
  { attr: "name" , label: "Item" },
  //Quantity displayed as an input
  { attr: "quantity", label: "Qty", view: "input"},
  
  
  
      //Price of item
      //{ attr: "price", label: "Price", view: "currency"},
      //Subtotal of that row (quantity of that item * the price)
      { attr: "total" , label: "SubTot", view: "currency"  }
  ],
  cartStyle: "table" ,
  checkout: {
  type: "SendForm" ,
  url: "/php/sendjs.php" ,
  method: "POST" ,
  
  
  
  
  }
  
  });
  
  simpleCart.bind( 'beforeCheckout' , function( data ){
  data.name = document.getElementById("name").value;
  data.textbox = document.getElementById("textbox").value;
  data.emaile = document.getElementById("emaile").value;
  data.phone = document.getElementById("phone").value;
  data.address = document.getElementById("address").value;
  });
  </code></pre>
  
  <p>Codepen link to simplecart.js</p>
  
  <p><a href="https://codepen.io/whispering_jack/pen/GveOjR?editors=0010v" rel="noreferrer">Copy of simplecart.js</a></p>