Jquery Client Won't Accept My Server Responses
Some days ago I wrote a python web service with flask to send some JSON-Data between my phone (android app) and my server. Everything worked fine: I could send and receive data via
Solution 1:
After some days(!) of research I finally found the very simple solution: HTTP access control (CORS).
Long story short - the following code fixed the problem.
I had to take the following steps on my server:
1.) Activate headers module for apache:
server# a2enmod mod_headers
2.) Modify VirtualHost file "myservice.conf" on my server and add the following line between.
Header set Access-Control-Allow-Origin "*"
3.) Check for any errors in your file:
server# apachectl -t
4.) reload and restart apache
server# service apache2 reload && service apache2 restart
5.) Enjoy the server client connection!
Hope I could help anyone who has the same problem!!
Post a Comment for "Jquery Client Won't Accept My Server Responses"