jQuery: I get OPTIONS request instead of GET

前端 未结 5 617
滥情空心
滥情空心 2020-12-05 15:25

I am using simple jQuery

$.get( .... );

Here instead of getting GET response I get OPTIONS.( checked in firebug Net)

Same code is w

5条回答
  •  攒了一身酷
    2020-12-05 15:33

    You are sending request to cross domain.

    For cross-domain requests, setting the content type to anything other than application/x-www-form-urlencoded, multipart/form-data, or text/plain will trigger the browser to send a preflight OPTIONS request to the server.

    So you may need change specify contentType to avoid OPTION request. Example:-

    $.ajax({
        url: "crossdomainurl",
        type: "GET",
        contentType: 'text/plain'
    }); 
    

提交回复
热议问题