title: Using x-www-form-urlencoded data on JQuery
body: <p>I am using postman to hit programmr.com api and the snapshot sucessfully looks like this:</p>
  
  <p><a href="https://i.stack.imgur.com/IEa7V.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/IEa7V.png" alt="enter image description here"></a></p>
  
  <p>Curl version:  pastebin.com/GQDZJALj</p>
  
  <p>And then I'm trying to hit the API using JQUERY using following code:</p>
  
  <pre><code>var data = "InputJSON:" +  JSON.stringify({  "mode": "java_example",  "apiKey": "bb6b589027a097b38e8cc47cffb8e70a",  "files": [    {      "name": "Test.java",      "content": "class Test{\n    \n public static void main(String[] arg){\n     \n     System.out.println(\"wwwwwww!!\");     \n  }\n\n}\n\n"    }  ], "eval code": ""});
  
            $.ajax({
              type: 'POST',
              url: "http://console.programmr.com/api/eval",
              headers: {'Content-Type': 'application/x-www-form-urlencoded'},
              contentType: 'application/x-www-form-urlencoded; charset=utf-8',
              dataType: 'json',
              data:  data,
              success: function (response) {
                  console.log(response);
                  return response;
              }
  </code></pre>
  
  <p>Raw string data:</p>
  
  <pre><code>InputJSON:{"mode":"java_example","apiKey":"bb6b589027a097b38e8cc47cffb8e70a","files":[{"name":"Test.java","content":"class Test{\n    \n public static void main(String[] arg){\n     \n     System.out.println(\"wwwwwww!!\");     \n  }\n\n}\n\n"}],"eval code":""}
  </code></pre>
  
  <p>The APIs response keep saying that my JSon is Invalid</p>
  
  <pre><code>{error: "Invalid JSON"}
  </code></pre>
  
  <p>My question is how to request to the API using the Javascript/JQuery just like postman done?</p>
  
  <p>Any help will be gratefully appreciated.</p>
  
  <p>Thanks in advance</p>
  
  <p>updated:</p>
  
  <p>it should be:</p>
  
  <pre><code> var data = "InputJSON=" +  JSON.stringify({  "mode": "java_example",  "apiKey": "bb6b589027a097b38e8cc47cffb8e70a",  "files": [    {      "name": "Test.java",      "content": "class Test{\n    \n public static void main(String[] arg){\n     \n     System.out.println(\"wwwwwww!!\");     \n  }\n\n}\n\n"    }  ], "eval code": ""});
  </code></pre>