when i try to get data from api i get this error in the console
Code:
user?callback=jQuery21406149524166248739_1436556997509&_=1436556997510:1 Uncaught SyntaxError: Unexpected token :
Code:
var creds = { username: "username", password: "password" }; var credentials = btoa(creds.username + ":" + creds.password); $.ajaxSetup({ xhrFields: { withCredentials: false }, beforeSend: function (xhr, settings) { xhr.setRequestHeader("Authorization", "Basic" + credentials); return true; } }); $.ajax({ url: 'http://site.com/api/v1/App/user', type: 'GET', dataType: 'jsonp', async: false, success: function (data) { console.log(data); } });
Comment