2

I use cross-domain $.ajax. When I use GET everything is ok, but when I try to send a POST I have some problem.

$.ajaxSetup({
    contentType: "application/json;charset=UTF-8"
});

Then:

$.ajax({
    'url': another_domain_url,
    'data': data,
    'type': 'post',
    'crossDomain': true,
    ...
});

When I use 'type'='get' here — everything is ok. But if I use 'post', I have in Chrome Console:

OPTIONS (my_url) net::ERR_EMPTY_RESPONSE
  l.cors.a.crossDomain.send           jquery.min.js:4
  o.extend.ajax                       jquery.min.js:4
  ...

And in the Network tab:

Request Headers CAUTION: Provisional headers are shown.
  Access-Control-Request-Headers:accept, content-type
  Access-Control-Request-Method:POST

What can I do?

Alx Aux
  • 53
  • 7
  • Wow, I just understood that "OPTIONS" is a method. Why "OPTIONS", when I send "POST"? – Alx Aux Jun 04 '14 at 14:40
  • Might be related to the issue you're seeing - http://stackoverflow.com/questions/1099787/jquery-ajax-post-sending-options-as-request-method-in-firefox – miqh Jun 04 '14 at 14:43
  • OPTIONS is part of what happens when you send a CORS request. what is your dataType? – Kevin B Jun 04 '14 at 14:48

0 Answers0