title: Ajax POST blocked by CORS Policy
body: <p>Hi I've been scrambling the web for hours now trying to find a solution.</p>
  <p>I'm trying to make a post request to my own web server hosted by Namecheap.</p>
  <p>Here's my Ajax code to call the Post request. Note: I can't show the url sorry.</p>
  <pre><code>             $.ajax({
                  url: &quot;https://api.someurl.com/something&quot; + avariable + &quot;/&quot; + anotherthing,
                  type: &quot;POST&quot;,
                  crossDomain: true,
                  dataType: &quot;json&quot;,
                  success: function (response) {
                      var resp = JSON.parse(response)
                      console.log(resp)
                  },
                  error: function (xhr, status) {
                      console.log(&quot;error&quot;)
                  }
              });
  </code></pre>
  <p>This was a code i got from another stackoverflow post's answer which had the most upvotes. It didn't seem to work. actually all of them didn't work.</p>
  <p>I'm calling this ajax from a index.html I have running on my localhost.</p>
  <p>And i got this error:</p>
  <pre><code>Access to XMLHttpRequest at 'the url i cant show' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
  </code></pre>
  <p>Any help would be much appericiated! I've never encountered this issue before and I don't know how to handle it.</p>
  <p><strong>Update 1</strong>
  I have access to the backend server. Its running Flask on Python.</p>
  <p>Any ideas how I can enable the CORS thing there?</p>
  <p>Also I'm not sure what the origin of this index.html will be. Because I'll be packaging it into an <code>electron js</code> desktop application.</p>