I am starting a new project but i am stuck at one place. I have created a site in laravel(php). And now i have created a domain on other server. And now when i use ajax to GET and POST data cross domain. I am not able to do so because every time i make a request it is giving me error in console that "Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin "domain.com" is therefore not allowed access. " Then i go through some articles and i found jsonp but the issue is that it only GET data and project also need POST method. Is there any solution for that ?
Asked
Active
Viewed 29 times
0
-
Share your code what you did so far. – Laxman Gite Jun 09 '17 at 12:12
-
No need to share code BEFORE doing a simple google. You need to set up CORS on your other domain. End of story – mplungjan Jun 09 '17 at 12:13
-
You have to set CORS headers and allow access from your second domain. And yes as @mplungjan said Google first :) – Armen Jun 09 '17 at 12:14