title: AJAX Failed to load resource: the server responded with a status of 403 (Forbidden)
body: <p>I tried everything available Online but I am still getting a error on AJAX Request. Tried with XMLHttpRequest() Request too but couldn't solve the problem.</p>
  
  <p>Here is my Ajax Request</p>
  
  <pre><code>$.ajax({
  type: "POST",
  url: "ajaxsubmit.php",
  data: {
    content: post_data
  },
  cache: false,
  success: function(result){
  alert("The Data have been Entered.");
  }
  
  });
  </code></pre>
  
  <p>This is My <strong>ajaxsubmit.php</strong></p>
  
  <pre><code>&lt;?php
  session_start();
  
  $servername = "localhost";
  $username = "root";
  $password = "";
  $dbname = "dataentry";
  
  $content = $_POST['content'];
  
  $tb_name = "pdf".$content[10];
  
  $conn = new mysqli($servername, $username, $password, $dbname);
  // Check connection
  if ($conn-&gt;connect_error) {
  die("Connection failed: " . $conn-&gt;connect_error);
  }
  
  $sql = "CREATE TABLE IF NOT EXISTS $tb_name (
  id INT(6) UNSIGNED AUTO_INCREMENT PRIMARY KEY, 
  APNR TEXT, APDA TEXT, TMNM TEXT, TMTY TEXT,OWNN TEXT,OWNA TEXT,
  OWNC TEXT,CORN TEXT,CLAS TEXT,DES TEXT, ENTRY_TYPE TEXT, LOGO_SRC TEXT
  )";
  
  if ($conn-&gt;query($sql) === TRUE) {
  echo "Table MyGuests created successfully";
  } else {
  echo "Error creating table: " . $conn-&gt;error;
  }
  
  $sql="insert into $tb_name (APNR, APDA, TMNM, TMTY,
  OWNN,OWNA,OWNC,CORN,CLAS,DES,ENTRY_TYPE,LOGO_SRC) values ('$content
  [0]', '$content[1]', '$content[2]','$content[3]','$content[4]','$content
  [5]','$content[6]','$content[7]','$content[8]','$content[9]','$content
  [11]','$content[12]')";
  
  if ($conn-&gt;query($sql) === TRUE) {
  echo "Table MyGuests created successfully";
  } else {
  echo "Error creating table: " . $conn-&gt;error;
  }
  
  $conn-&gt;close();
  ?&gt;
  </code></pre>
  
  <p>I tried <strong>XMLHttpRequest()</strong> This way,</p>
  
  <p><strong>JS PART</strong>
      var http = new XMLHttpRequest();</p>
  
  <pre><code>var url = "ajaxsubmit.php";
  var params = "lorem=ipsum&amp;name=binny";
  http.open("POST", url, true);
  
  //Send the proper header information along with the request
  http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  http.setRequestHeader("Content-length", params.length);
  http.setRequestHeader("Connection", "close");
  
  http.onreadystatechange = function() {//Call a function when the state
  changes.
  if(http.readyState == 4 &amp;&amp; http.status == 200) {
  alert(http.responseText);
  }
  }
  http.send(params);
  </code></pre>
  
  <p><strong>Please give me your best suggestion as solution.</strong></p>