I am using the simple XMLHttpRequest object to make an cross domain batch request with datajs 1.0.3.
A preflight request is beeing sent to the server as expected:
OPTIONS http://localhost:64109/Services/ScheduleService.svc/$batch HTTP/1.1
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.19 (KHTML, like Gecko) Chrome/18.0.1025.162 Safari/535.19
Access-Control-Request-Headers: origin, maxdataserviceversion, content-type, accept, dataserviceversion
The Server responds accordingly setting some headers as proposed for preflight requests (see: http://www.w3.org/TR/access-control/)
HTTP/1.1 200 OK
Server: ASP.NET Development Server/10.0.0.0
Date: Mon, 07 May 2012 17:48:02 GMT
Access-Control-Allow-Methods: GET, POST, PUT, DELETE
Access-Control-Allow-Headers: Content-Type, Accept
I am getting an error message for the batch request saying "HTTP request failed".
What do I have to do? Does datajs do not handle the preflight response on it's own?
Would be happy to get some help on this.
the problem is solved:
One of the headers in the response of the server had to be extended by two more headernames:
Access-Control-Allow-Headers: Content-Type, Accept,
I'm glad you were able to solve your issue. It is great that you are using datajs with CORS and I will love to get any feedback for your experience with it :).