I am trying to make a json call, by passing the credentials. If the user is already logged into the system using Sql Membership, how can I pass the credentials without getting this:

Here is the code that calls the web.api:
NOTE: call is being made from cross domain: i.e. www.project.com -> api.project.com
var url = 'http://api.project.com/LookUps/uploadtypes?callback=?';
$.ajax({
type: 'GET',
url: url,
async: true,
xhrFields: {
withCredentials: true
},
jsonpCallback: 'handler',
contentType: "application/javascript",
dataType: 'jsonp',
success: function (json, textStatus, jqxhr) { console.log(jqxhr.responseText); },
error: function (json, textStatus, jqxhr) { console.log(jqxhr.responseText); }
});
Edit:
I still get the login when authentication is disabled. Is there another place for the window authentication setting?

To prevent this popup you have to change your URL to following.
var url = 'http://username:password@api.project.com/LookUps/uploadtypes?callback=?';
replace username - with actual username and password with actual password.
来源:https://stackoverflow.com/questions/25767558/passing-credentials-not-working