views:

489

answers:

3

I have an issue where I executing an AJAX request. Instead of seeing the normal POST or GET preceeding the action page url, I see OPTIONS. The data is successfully posted, but there is no response from the action page. What does OPTIONS indicate?

+2  A: 

"The OPTIONS method represents a request for information about the communication options available on the request/response chain identified by the Request-URI. This method allows the client to determine the options and/or requirements associated with a resource, or the capabilities of a server, without implying a resource action or initiating a resource retrieval."

source

mxmissile
Yes, but... why is Firefox not GETting or POSTing?
Pistos
I've since learned that it is because it is a cross-site / cross-domain AJAX attempt. You need to use $.getJSON or $.ajax to issue a JSONP request to do cross-site.
Pistos
+2  A: 

This is due to a cross-domain AJAX attempt. Sometimes something as harmless-looking as requesting h ttp://www.example.com from h ttp://example.com can cause unexpected behavior.

Greg
@greg this just saved my life. I've been pulling my hair out over this for two days.
Jascha
A: 

This post helped me solve my problem. Turns out, even with jsonp as data type, I was not getting a response. In the end, I needed to specify the data type as json and then make my url relative. I was always used to using full http:// paths for ajax calls, but even with jsonp, the results were blank. Picky picky, but at least there was an answer out there. Thanks

fleces