1
  $.ajax({
            type: "GET",
            url: "http://shoperola.com/Restaurant/foodysrest/sample",
            crossDomain: true,
            cache: false,
            dataType: "json",
            Complete: function(xhr) {xhr.getResponseHeader("Accept", "json")}, 
            success: function (data, textStatus, xhr) {
                console.log(data);
                console.log(xhr.getResponseHeader("Content-Length"));
            },
            error: function (xhr, textStatus, errorThrown) {
                console.log(errorThrown+"---"+textStatus);
            }
        });

this code returns HTTP status "200" but fires error. Please any one suggest me how to perform a webservice.

This is the error:

"XMLHttpRequest cannot load http://shoperola.com/Restaurant/foodysrest/sample?_=1389172009980. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://<localhost>:3294' is therefore not allowed access."
  • 1
    "The resource identified by the request is only capable of generating response entities which have content characteristics not acceptable according to the accept headers sent in the request." My guess is that it's telling you it can not respond with JSON (that's what you're asking it for). Here is an analogy http://www.flickr.com/photos/girliemac/6508023119/in/set-72157628409467125 – Benjamin Gruenbaum Jan 08 '14 at 06:45
  • http://www.checkupdown.com/status/E406.html - Looks like it can return JSON but does not agree to one of the other `Accept-*` headers in your request. Check the network tab in inspector to see your request headers. – techfoobar Jan 08 '14 at 06:46
  • check this out http://stackoverflow.com/questions/1846086/why-does-ajax-call-for-json-data-trigger-the-error-callback-when-http-status-c?rq=1 – rajesh kakawat Jan 08 '14 at 11:23
  • the response which i get from the url i'm using is a valid json no errors in that response json, still i get same error – user2617873 Jan 08 '14 at 11:30

0 Answers0