I need to fix that error that appears in the app's console.
1.- You can add a proxy in the ionic.config.json file of your Ionic app to perform tests. In the documentation it tells you how to: service-proxies .
2.- Your server must allow javascript requests from other servers in order to obtain information from the original server. More information on Wikipedia: CORS , Mozilla CORS .
Those are the 2 possible solutions to the restrictions you have to be able to make your requests.
Another option would be in your php script to add:
header("Access-Control-Allow-Origin: *");
Or if you are using the slim framework according to the documentation:
$app->options('/{routes:.+}', function ($request, $response, $args) {
return $response;
});
$app->add(function ($req, $res, $next) {
$response = $next($req, $res);
return $response
->withHeader('Access-Control-Allow-Origin', 'http://mysite')
->withHeader('Access-Control-Allow-Headers', 'X-Requested-With, Content-Type, Accept, Origin, Authorization')
->withHeader('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, PATCH, OPTIONS');
});