Reputation: 229
I have a xml content stored in the location, http://localhost:8080/cleo-primer/rest/elements/search?uid=1&query=facebook
<element-list><element><term>facebook</term><name>Bing Facebook</name></element></element-list>
I am sending a get request
$.get('http://localhost:8080/cleo-primer/rest/elements/search', { uid: 1, query: request.term }, function(responseData){alert(responseData);});
but this gives me a blank response and when I check using my firebug, it shows XML Parsing Error: no element found Location: moz-nullprincipal:{1e7688d3-7b3c-43ae-9142-5b183a7cbfda} Line Number 1, Column 1: inside XML tab
Upvotes: 0
Views: 600
Reputation: 6420
You are doing a cross origin call that is not allowed. You are calling from: http://localhost
to http://localhost:8080
. The call isn't executed and there will be NO response. Chrome/Safari will show an error like this in the console:
XMLHttpRequest cannot load
http://targeturl
Originhttp://localhost
is not allowed by Access-Control-Allow-Origin.
More info: http://en.wikipedia.org/wiki/Same_origin_policy#Origin_determination_rules
If you can make modifications to the back-end, making it send the right headers, will fix your problem... (Access-Control-Allow-Origin yourdomain
or Access-Control-Allow-Origin *
for allow all)
More info: http://enable-cors.org
A couple of other options to be complete...
Upvotes: 1