3 Replies Latest reply on Nov 30, 2018 9:44 AM by David_Powers

    I need help with - Cross-Origin Request Blocked

    revdave Level 1

      Hi all,

       

      I am on a mac trying to get a result back from this code below.

       

      On the app Postman (on mac) is works fine, However I get these errors below when pasted into a basic test html page...

       

      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://chosenpayments.transactiongateway.com/api/query.php. (Reason: CORS header ‘Access-Control-Allow-Origin’ missing).

       

      Cross-Origin Request Blocked: The Same Origin Policy disallows reading the remote resource at https://chosenpayments.transactiongateway.com/api/query.php. (Reason: CORS request did not succeed).

       

      Also: I have no access to the site - chosenpayments.transactiongateway.com

       

      Q: How can I get the html page to not get *Cross-Origin Request Blocked* errors when the postman app works with no problems?

       

       

      <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>

       

      <script>

      var form = new FormData();

      form.append("username", "xxx");

      form.append("password", "xxx");

      form.append("transaction_id", "xxx");

      form.append("", "");

       

      var settings = {

      "async": true,

      "crossDomain": true,

      "url": "https://chosenpayments.transactiongateway.com/api/query.php",

      "method": "POST",

      "headers": {

      "cache-control": "no-cache",

      "Postman-Token": "f397621c-8738-4b3c-a137-e0fa755a04ec"

      },

      "processData": false,

      "contentType": false,

      "mimeType": "multipart/form-data",

      "data": form

      }

       

       

      $.ajax(settings).done(function (response) {

      console.log(response);

      });

       

        </script>