I have an error on using the ajax request below.
$.ajax({
url: "http://webservice.users.com:8000/users",
dataType: 'jsonp',
beforeSend: function (xhr) {
xhr.setRequestHeader("Authorization", "Basic b2d1e77hbi5lcmVu1BhczRVYg");
},
success: function (json) { console.log(json); },
error: function (httpReq, status, exception) {
console.log(status + " " + exception);
}
});
My call is cross-domain and it result is text/html (maybe jquery can't convert result to application/json)
Console errors:
parsererror Error: jQuery18206287364205345511_1351595013388 was not called
Error: "SyntaxError: Unexpected token : " in chrome browsers.
Chrome Developer Tools service response headers:
Cache-Control:no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Connection:Keep-Alive
Content-Encoding:gzip
Content-Length:180
Content-Type:text/html
Date:Tue, 30 Oct 2012 10:36:57 GMT
Expires:Thu, 19 Nov 1981 08:52:00 GMT
Keep-Alive:timeout=15, max=100
Pragma:no-cache
Server:Apache/2.2.16 (Debian)
Set-Cookie:active_style=style; expires=Wed, 30-Oct-2013 10:36:57 GMT
Vary:Accept-Encoding,User-Agent
Server response body:
{
"data": {
"islogin": "0"
},
"userdata": {
"login": "0"
},
"rstatus": {
"status": "0",
"errno": "5555",
"mesg": "blablabla"
}
}