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);
}