Uncaught SyntaxError: Unexpected token : when using api
Collapse
X
-
HI,
if there is problem with the code maybe you can add working example to doc so we can have a start point.
and whats wrong with this code?Leave a comment:
-
i also tried: and the same error:
Uncaught SyntaxError: Unexpected token :
Code:var username = 'admin'; var password = '1'; $.ajax ({ type: "GET", dataType: 'json', async: false, url: "http://demo.espocrm.com/basic/api/v1/App/user?callback=?", headers: { "Authorization": "Basic " + btoa(username + ":" + password) } }) .done(function(){ alert('Authenticated!') }) .fail(function(){ alert('Error!') });Leave a comment:
-
Uncaught SyntaxError: Unexpected token : when using api
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); } });Tags: None

Leave a comment: