0

i am new to breeze and odata..

im trying to fetch data from odata api using breeze in angular...

heres my code:

//adding authorization to the header
        var authObj = localStorageService.get('authorizationData');
        var token = 'Bearer ' + authObj.token;
        var oldClient = OData.defaultHttpClient;

        var myClient = {
            request: function (request, success, error) {
                request.headers.Authorization = token;
                return oldClient.request(request, success, error);
            }
        };

        OData.defaultHttpClient = myClient;

        baseService.getBreezeAdapter;

        breeze.NamingConvention.camelCase.setAsDefault();
        var manager = baseService.newManager();

        var query = new breeze.EntityQuery()
                        .from('Customers');


        function fetchData() {
            manager.executeQuery(query)
                .then(function (data) {
                    console.log(data)
                })
                .catch(function (fail) {
                    console.log(fail)
                })
                .finally(function (response) {

                });
        };

when i look into fiddler.. there was no error..its working fine..

but after the query it falls down to catch which is fail.. it returns an error message "; ", but it said that the statustext is ok and it has the data in its body element..

here is the actual error

{message: "; ", statusText: "OK", status: 200, url: "http://xxxxxx.net/odata/Customers", body: Object…}

can someone can explain to me why its returning an error ";"

  • Maybe a duplicate of this question? http://stackoverflow.com/questions/13525097/jquery-ajax-status-200-ok-but-no-data-response – María Karlsdóttir Jan 28 '15 at 13:42
  • I had the same issue a while back and it was due to cross origin request sharing not being enabled in my web.config. It's a simple fix, are you using IIS? Or can you enable this on the server? –  Feb 10 '15 at 18:49

0 Answers0