Hi all,
I use the following code to get some json data:
var request = new Request.JSON(
{
'url': sourceURI,
'onSuccess': onPageData
}
);
request.get();
Request.JSON is a class from Mootools (a javascript library).
But on linux (ubuntu on firefox 3.5 and Chrome) the request always fails. So i tried to display the http request ajax is sending. (I used netcat to display it)
The request is like this:
OPTIONS /the+url HTTP/1.1
Host: example.com
Connection: keep-alive
User-Agent: Mozilla/5.0 (X11; U; Linux i686; en-US) AppleWebKit/532.3 (KHTML, like Gecko) Chrome/4.0.226.0 Safari/532.3
Referer: http://example.com/ref...
Access-Control-Request-Method: GET
Origin: http://example.com
Access-Control-Request-Headers: X-Request, X-Requested-With, Accept
Accept: */*
Accept-Encoding: gzip,deflate
Accept-Language: en-US,en;q=0.8
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.3
The HTTP request (first line) is not how it should be:
OPTIONS /the+url HTTP/1.1
It should be:
GET /the+url HTTP/1.1
Does anybody know why this problem is and how to fix it?
Edit:
The ajax request gets the following result from my Apache server:
HTTP/1.1 200 OK
Date: Fri, 23 Apr 2010 08:09:41 GMT
Server: Apache/2.2.15 (Debian)
Allow: GET,HEAD,POST,OPTIONS
Content-Length: 0
Keep-Alive: timeout=15, max=100
Connection: Keep-Alive
Content-Type: text/plain
The content-length should not be zero. But i think, the Request.JSON module whould now see that the GET request is available and can use it?