I made some tests but the server I try to connect is not on the same domain.
The problem is that GOOGLE CHROME doesn't allow cross domain requests (CORS).
I got this error : "Response to preflight request doesn't pass access control check: No 'Access-Control-Allow-Origin' header is present on the requested resource."
I found that adding this line to my server.php can partially solve the problem :
But now the error is different : "Response for preflight has invalid HTTP status code 401"
What does it mean ?
How can I fix this ?
This isn't very secure because the user can read the code.
Is there a solution to avoid this ?