Search code examples
jqueryhttp-headersodatadatajs

Disable 'options' verb in datajs


My hosting provider does not accept the 'Options' verb when sending a odata.read request using datajs.

Doesn't work:

OPTIONS http://odata.resporter.tv/odata/timelines HTTP/1.1
Accept: */*
Origin: http://*******.***
Access-Control-Request-Method: GET
Access-Control-Request-Headers: accept, maxdataserviceversion
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Host: ****.*******.**
Content-Length: 0
DNT: 1
Connection: Keep-Alive
Pragma: no-cache

Works:

Accept: */*
Origin: http://******.**
Access-Control-Request-Method: GET
Access-Control-Request-Headers: accept, maxdataserviceversion
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)
Host: ****.********.**
Content-Length: 0
DNT: 1
Connection: Keep-Alive
Pragma: no-cache

Notice the 'OPTIONS' header in the request that doesnt work.

Does somebody know if i can not send the 'options' header using datajs?


Solution

  • it's your browser which sends the options header because of CORS. Either you can use jsonp or host your html where your host your data endpoint