3
$.get('http://localhost/a.bb?cmd=<abc></abc>', function(data) {
   alert('result comes back.');
   $('.result').html(data);
  });
);

Above is the code I want send to server, why jquery send OPTION for me? I want GET method.

Thanks.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
Bin Chen
  • 61,507
  • 53
  • 142
  • 183
  • possible duplicate of [jQuery $.ajax(), $.post sending "OPTIONS" as REQUEST_METHOD in Firefox](http://stackoverflow.com/questions/1099787/jquery-ajax-post-sending-options-as-request-method-in-firefox) – tvanfosson Oct 19 '10 at 14:29

2 Answers2

9

jQuery/webbrowser will send a HTTP OPTIONS request whenever the URL concerns a different domain than the one from which the inital page is been requested and the jQuery dataType is not JSONP. On an OPTIONS request, the server should return an Allow header with all HTTP methods which are allowed to be used. E.g. GET,POST. The webbrowser will then continue the actual XMLHttpRequest.

This all is in the name of Same Origin Policy.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
1

this probably coming from your browser, or the way you format your get request it my be safer to pass the data as

$.get('http://localhost/a.bb',{"cmd":"<abc></abc>"}, function(data) {
        alert('result comes back.');
        $('.result').html(data);
    });
);
dvhh
  • 4,724
  • 27
  • 33