Estoy llamando a una API con fetch, al hacer el llamado me sale lo siguiente:
Failed to load http://mppromocionales.com/ws_products.php: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
En la documentación me dieron dos datos: Solicitud API *** Cuenta: ********
Tengo este script para el llamado de la api:
const direccionUrl = 'http://mppromocionales.com/ws_products.php',
parametros = {
method: 'GET',
mode: 'cors',
redirect: 'follow',
headers: new Headers({
'Content-Type': 'application/json'
})
},
request = new Request(direccionUrl, parametros)
No logro acceder y no se donde podría agregar los datos que me dan para poder tener acceso.