jQuery: I get OPTIONS request instead of GET

前端 未结 5 619
滥情空心
滥情空心 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:37

    This is likely due to restrictions on Javascript doing cross-domain XMLHttpRequests. This is generally not allowed for security reasons. See the question referenced above, or a similar question I asked.

    To solve this problem:

    • Write a sever side component (using PHP or whatever) that will retrieve the remote resource on behalf of your AJAX request, or
    • Do a JSONP call: see http://www.insideria.com/2009/03/what-in-the-heck-is-jsonp-and.html (or hunt around StackOverflow for JSONP) :)

    Hope that helps!

提交回复
热议问题