title: javascript cannot surpass xmlhttprequest error using ajax/JS/mysql/php
body: <p>we have on the client side running this javascript code:</p>
  
  <pre><code>var src;
  var y = document.getElementById('trigger-image-toll-id');
  function addListener() {
      src = $('#nice_image').attr("src");
      alert(src);
  }
  y.click();
  setTimeout(function(){
  addListener()
  }, 5000);
  
  $.ajax({
      method: "POST",
      url: "http://www.orc23.com/insert.php",
      data: { theurl: src, asker: "test", solution53: "" }
  })
      .done(function( msg ) {
      alert( "Data Saved: " + msg );
    });
  </code></pre>
  
  <p>Remote server side we have this php file I am trying to use to insert data into mysql DB:</p>
  
  <pre><code>&lt;?php
  
  header('Access-Control-Allow-Origin: *');
  header('Access-Control-Allow-Methods: GET, POST, PATCH, PUT, DELETE, OPTIONS');
  header('Access-Control-Allow-Headers: Origin, Content-Type, X-Auth-Token');
  
  
  $con =
  mysqli_connect("orc23com.coooscowmysql.com","jim","jim123","coolbeans");
  //$con = mysqli_connect("localhost","root","","cl30-ssndb");
  if (!$con)
    {
    die('Could not connect: ' . mysqli_connect_error());
    }
  
  mysqli_select_db($con, "coolbeans");
  
  $sql="INSERT INTO requests (theurl, asker, solution53)
  VALUES
  ('$_POST[theurl]','$_POST[asker]','$_POST[solution53]')";
  
  if (! mysqli_query($con,$sql))
    {
    die('Error: ' . mysqli_error());
    }
  
  mysqli_close($con)
  ?&gt;
  
  &lt;a href="index.php"&gt;Back To Home Page Click Here&lt;/a&gt;
  </code></pre>
  
  <p>I've already tried to disable web security with Chrome option for my Chrome Browser but still getting this error here:</p>
  
  <blockquote>
    <p>xmlhttprequest cannot load REMOTE WEBSITE HERE WITH A "insert.php"  . response to preflight request doesn't pass access control check: no 'access-control-allow-origin' header is present on the requested resource. origin 'adifferentwebsite' is therefore not allowed access.</p>
  </blockquote>