I send a rest request to a server and getting back a status 200 ok, but there is no content in the response.
$.getJSON("http://192.168.0.94:8084/datasnap/rest/TServerMethods1/ReverseString/sfasda/", function(data) {
alert(data);
});
I debugged with firebug this and are the headers:
Connection close
Content-Length 21
Content-Type text/html; charset=ISO-8859-1
Pragma dssession=188802.418847.903604,dssessionexpires=1200000
Request Headers
Accept application/json, text/javascript, */*; q=0.01
Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7
Accept-Encoding gzip, deflate
Accept-Language en-us,en;q=0.5
Connection keep-alive
Host 192.168.0.94:8084
Origin http://192.168.0.92
Referer http://192.168.0.92/visuals/index.php?page=pincodescreen
User-Agent Mozilla/5.0 (Windows NT 5.2; rv:5.0) Gecko/20100101 Firefox/5.0
what do i wrong?
Your doing a cross domain request, which won’t work due to JavaScript same origin policy. Your request originates from a document of
http://192.168.0.92, while the target ishttp://192.168.0.94:8084/. To my knowledge even different ports trigger the policy making it inpossible to request data directly.Assuming you have control over the second server, rewrite your request to use JSONP.