title: 406-Not Acceptable Response - jQuery AJAX
body: <p>I am receiving the 406 error when I am sending a JSON data object through the jQuery AJAX function to a backend service so the data can be stored into the database. </p>
  
  <p><strong>AJAX FUNCTION</strong></p>
  
  <pre><code>data = {
    questions: questions,
    test_id: test_id,
    action: 'update'
  };
  
  gmtjax({
      url: gmt.contextPath + 'tests/questions/process_form',
      type: 'POST',
      data: data,
      dataType: 'json',
      $spinner: gmt.$spinnerContainer,
      success: function(returnData) {
        console.log('success');
      },
      error: function(){
        //console.log('error');
      },
      $errorContainer: gmt.$mainContainer
  });
  </code></pre>
  
  <p><strong>JSON structure:</strong></p>
  
  <pre><code>{
      "test_id": "1",
      "action": "update",
      "questions": [
          {
              "question": "Exploitation strategies seek to create value from unfamiliar resources and activities.",
              "options": [
                  {
                      "name": "True"
                  },
                  {
                      "name": "False"
                  }
              ]
          }
      ]
  } 
  </code></pre>
  
  <p><strong>Process Form Function (Backend)</strong></p>
  
  <pre><code>function process_form(){
    print_r($_POST);
  }
  </code></pre>
  
  <hr>
  
  <p>When I submit the data the STATUS CODE on the XHR request is 406 Not Acceptable.</p>
  
  <p><strong>Request Header</strong></p>
  
  <pre><code>Accept:application/json, text/javascript, */*; q=0.01
  Accept-Encoding:gzip,deflate,sdch
  Accept-Language:en-US,en;q=0.8,af;q=0.6,ms;q=0.4
  Cache-Control:no-cache
  Connection:keep-alive
  Content-Length:1726
  Content-Type:application/x-www-form-urlencoded; charset=UTF-8
  Cookie:ci_session=08c62699d06dfcf8ba853cacb350ab3b
  Host:testingsite.com
  Origin:https://testingsite.com
  Pragma:no-cache
  Referer:https://testingsite.com/tests/manage/id/194/goto/2
  User-Agent:Mozilla/5.0 (Macintosh; Intel Mac OS X 10_9_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/31.0.1650.63 Safari/537.36
  X-Requested-With:XMLHttpRequest
  </code></pre>
  
  <p><strong>RESPONSE</strong></p>
  
  <pre><code>false
  </code></pre>
  
  <p>When the request fails it does not even enter the process_form function to print out the POST array.  </p>
  
  <hr>
  
  <p>However, when I modify the 'create value' string in the question to something like 'create <strong><em>a</em></strong> value' the form submits successfully.  The only thing I can think of is some SQL Injection prevention detection on the server layer (GoDaddy) but I am unsure on how to address this. </p>
  
  <p>What could be causing the 406 error when Content-Type is obviously not the issue.</p>