I am learning ionic and i have created a simple signup app in ionic 5.
I am getting this error when i try to call api for posting data.
Access to XMLHttpRequest at 'http://localhost:8888/php_project/mango/signup.php' from origin 'http://localhost:8100' has been blocked by CORS policy: Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource.
I tried by setting headers in my post request but still getting same error. Here are the headers i am setting for post request:
'Access-Control-Allow-Headers': 'Content-Type',
'Content-Type': 'application/json',
'Access-Control-Allow-Origin': '*',
'Access-Control-Allow-Methods': 'PUT, POST, GET, OPTIONS, DELETE',
What else need to be done to call api from ionic.