title: jQuery ajax fails in Samsung phone
body: <p>I have encountered a peculiar problem using jQuery (3.3) ajax. I have simplified the code to bare minimum and still can't understand why it is happening.</p>
  
  <p>From an HTML form I capture the 'Submit' and call a PHP script using ajax. The ajax call is successful if I use Chrome or Edge on a (Win10) laptop or Chrome on an older Samsung Note II (running Android 4.x), or Safari on iPhone, or two other Android phones, but it fails (hits the error clause) using either Chrome or Samsung stock browser on a Samsung A5 phone. All the HTML/JavaScript/PHP are on the same server and same domain so no cross domain scripting.</p>
  
  <p>JavaScript:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(document).on("submit", function(ev) {
   alert ('submit pressed');
   ev.preventDefault();
   var destination = encodeURI ("https://example.com/contact.php");
   
   var datastring = "test";
   
   $.ajax({
    type: 'POST',
    url: destination,
    data: datastring,
    success: function (result) {
     alert ('success');
    },
    error: function(req, status, err){
     alert ('error');
    },
    complete: function(result){
     alert ('complete');
    }
   });
  });</code></pre>
  </div>
  </div>
  </p>
  
  <p>PHP - I have taken everything out in the cotnact.php:</p>
  
  <pre><code>&lt;? php
  exit(0)
  ?&gt;
  </code></pre>
  
  <p>I get 3 alerts if I use laptop, iPhone, or 3 other Android phones:</p>
  
  <ol>
  <li>submit pressed</li>
  <li>success</li>
  <li>complete</li>
  </ol>
  
  <p>However instead of success I get error in the Samsung A5:</p>
  
  <ol>
  <li>submit pressed</li>
  <li>error</li>
  <li>complete</li>
  </ol>
  
  <p>By the way, although the call in the A5 phone hits the "error" clause, the PHP code is indeed gets executed (I had the whole script working by writing to files, sending email notifications, ... but removed everything to simplify)</p>
  
  <p>Does anybody have any idea why this is happening and more importantly how can anybody be sure that his/her code is working on any device when the code is at a such basic level without testing every and each device? </p>
  
  <p>Thank you in advance if you can shed any light on this and point me to what I am missing in either my code, setup, or understanding.</p>