Here is my code,I want to request a cross domain url to use API based on basic authorization.
but it does not work. no Authorization info showed in request headers.
$(document).ready(function () {
$.ajaxSetup({
headers: {
'Authorization': "Basic amlhemhc6SUxvdmVAkYXk="),
'Content-Type': 'application/json;charset=utf-8'
}
});
var request = $.ajax({
url: "http:localhost:8080/query",
type: "POST",
data: '{"sql":"select count(*) from summary"}',
dataType: "json"
});
request.done(function (msg) {
alert(msg);
});
request.fail(function (jqXHR, textStatus) {
alert("Request failed: " + textStatus);
});
});
