Q:

Web api asp.net ajax request for Bearer token login work in fiddler but does not work in ajax call

I am using the new mobile tool Apache codova with jquery mobile in visual studio. I am trying to make ajax request to asp.net web api to login. using /Token in the default individual account. The request returns error in the ajax but when i check fiddle the token is return with status of 200 OK, i want the ajax success function to return the token. Any help will be appreciated. 
This is my code:
var loginData = {
        grant_type: "password",
        username: $("#LoginEmail").val(),
        password: $("#LoginPassword").val()
    };

    $.ajax({
        type: 'POST',
        url: storeUrl + '/Token',
        data: loginData
    }).done(function (data) {
        alert(data.userName);
        alert(data.access_token);

    }).fail(showError);

    function showError(req, s, t)
    {
        alert('Request Status: ' + req.status + ' Status Text: ' + req.statusText + ' ' + req.responseText);
    }

A:

I fix this by adding .
context.OwinContext.Response.Headers.Add("Access-Control-Allow-Origin", new[] { "*" });

In the  GrantResourceOwnerCredentials() function of ApplicationOAuthProvider class of my web api project.

