eXtreme
eXtreme

Reputation: 31

fiddler shows 200/OK response but jquery receives error in asp.net web api cors

I was trying to implement CORS by following the post here.

It's just that when I execute a jquery call it is receiving error. The response text is '' with status text as 'error'.

But, looking into Fiddler the response is 200/OK with the correct json-formatted result.

here's my jquery call:

$.getJSON("http://localhost:9999/api/v1/xxxxxxxx/", function (allData) {
                log.debug(allData);
            }).success(function (allData) {
            }).error(function (xhr, status, data) {
                console.log(xhr);
                console.log(data);
                console.log(status);
            });

here's the screenshot of the response:

1] Firebug

What am I missing?

Upvotes: 1

Views: 1768

Answers (1)

Brock Allen
Brock Allen

Reputation: 7435

A 200 OK response still might mean a CORS failure. The response needs to have the right response headers to allow the Ajax call.

From your screen shot your Access-Control-Allow-Origin response header is wrong -- it should just be * but your has *, * for some reason.

Upvotes: 1

Related Questions