开发者

jquery: why $.get send OPTION packet?

$.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 sen开发者_JS百科d OPTION for me? I want GET method.

Thanks.


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.


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);
    });
);
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜