I am using simple jQuery
$.get( .... );
Here instead of getting GET response I get OPTIONS.( checked in firebug Net)
Same code is w
I had the same issue, the cause I figured was in the html <head>
section I had set the base element to this
<base href="http://local.develepment.url" />
Which I changed to
<base href="http://<?php echo $_SERVER['HTTP_HOST']?>/" />
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'
});
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:
Hope that helps!
The OPTIONS
request what you see is the preflight request, you can read about that here:
It's there because you're requesting a cross-domain XMLHttpRequest so the browser has to check whether your request is allowed on the remote server or not.
There are two solutions to solve the problem (as mentioned above):
OPTIONS
request with the corresponding Access-Control-*
headersI hope this helps someone: http://kurund.com/blog/2010/09/09/how-to-call-external-site-url-using-jquery-ajax/