S
S
sanex33392015-05-05 12:15:49
JavaScript
sanex3339, 2015-05-05 12:15:49

Why does CORS Ajax POST request fail every other time on iOS7?

So, I ran into a problem, only in iOS7 , when a CORS Ajax POST request is made to the server, every 2nd or 3rd request does not pass, it fails. Fail only if the server returns any data, in my case json.
I checked with different headers, it always fails every other time, however, if you put it there will be no errors, however, json will not be given. json - the most primitive Header's that I tried and with which it gives an error every other time :
header('Content-Length: 0');

'{"test1":"test1", "test2":"test2"}'

header('Access-Control-Allow-Origin: *');

header('Content-Type: application/json');
  header('Content-Length: '. strlen($response));
  header("Cache-Control: no-cache, no-store");
  header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
  header('Pragma: no-cache');
  header('P3P: CP="NID DSP ALL COR"');
  header('Access-Control-Allow-Methods:POST, GET, OPTIONS');
  header('Access-Control-Allow-Headers:Content-Type, x-xsrf-token, X-Requested-With, Authorization, Content-Length, Cookie');
  header('Access-Control-Allow-Origin: *');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
sanex3339, 2015-05-06
@sanex3339

I figured out the problem, it's in the browserstack (in the browserstack virtual machine or in the ios7 simulator). There is no error on a real Ios7 device.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question