I'm doing my best to understand how I'm still getting this error when following the CORS guide (that they recommend to follow themselves) on https://www.html5rocks.com/en/tutorials/cors/
The error I'm receiving is:
Failed to load https://bittrex.com/api/v1.1/public/getmarketsummaries: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost:3000' is therefore not allowed access.
Based on this, I'm thinking the issue is inside the $.ajax call?
import React, { Component } from 'react';
import './App.css';
import $ from 'jquery';
export default class TokenList extends Component {
constructor(props) {
super(props);
this.state = {
object : []
};
}
componentDidMount() {
this.TokenList();
}
TokenList() {
// Method currently not working...
// Method 1
$.ajax({
type: 'GET',
url: 'https://bittrex.com/api/v1.1/public/getmarketsummaries',
contentType: 'text/plain',
xhrFields: {
withCredentials: false
},
success: function() {
console.log('Access Granted!');
},
// Error suggests the issue is here?
headers: {
'Access-Control-Allow-Origin' : 'http://localhost:3000'
},
error: function() {
alert('Error making the request');
}
})
}