jQuery.ajax not return response (CORS fail)

2019-07-23 20:28发布

i have two server. One, with some back-end development sites, with api support, and other one, who wanna make some jQuery.ajax requests. I think, that's a easy part, but for now - make me crazy. I tryed add header in my nginx configuration, adding header with $.ajax({'headers'}), but still can't read the response from server. When i try add

xhrFields = {
    withCredentials: true
}

in firebug i see status code 200, but response is missing (json response). I read maybe everything for CORS requests, but ... nothing for now.

I try RestClient (mozilla addons), and there everything work perfect. Why? I can't understand that browser restriction, and ... i will kill myself in next few hours :)

I tried jQuery 1.11.3 and last release 2.1.4, and both not working (for me, of course :))

Server response with these headers:

That's all headers

Status Code: 200 OK
Connection: Keep-Alive
Content-Encoding: gzip
Content-Length: 51
Content-Type: text/html
Date: Thu, 02 Jul 2015 12:32:40 GMT
Keep-Alive: timeout=15, max=100
Server: Apache-Coyote/1.1
Vary: Accept-Encoding
access-control-allow-headers: Content-Type,X-Requested-With,accept,Origin,Access-Control-Request-Method,Access-Control-Request-Headers
access-control-allow-methods: POST, GET, OPTIONS, PUT, DELETE,
access-control-allow-origin: *
access-control-max-age: 3600

pp Sorry for my bad english :#

0条回答
登录 后发表回答