Open jkimilu opened 8 years ago
figured that i needed to load the plugin and then paste the dispatch code right after. No errors but still getting XMLHttpRequest cannot load http://192.168.0.12/rms/mobile-pos/login.json. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://localhost' is therefore not allowed access. Kindly assist how to get ride of this cross domain issue.
Cake Controller classes follow the UpperCamelCase convention and typically you can omit the 'Controller' from controller class names when they're being called in a CakePHP controller specific context.
DispatcherFactory::add('Cors.Cors', ['routes' => [
'MobilePos'
]]);
If this doesn't work for you, I would suggest running the tests and seeing if any tests are failing on your specific version of Cake.
I am a newbie in cakephp and so far am loving it. Am trying to build a mobile app that will consume json apis within my cake, but i have not been successful as my cross domain requests are being blocked and thats how i have ended up here.
I have the pasted the following in bootstrap.php DispatcherFactory::add('Cors.Cors', ['routes' => [ 'mobilePosController' ]]);
also pasted the cors filter plugin into Plugins folder and renamed the folder from cakephp-cors to just Cors.
Why am getting the error in subject line above.