更新时间:2022-01-18 21:25:30
取出"headers"
和"dataType"
.您的请求将如下所示:
Take out the "headers"
and "dataType"
. Your request will then look like this:
$.ajax({
type: "GET",
url: "http://localhost:3000/readings",
success: function (data) {
var mem = data.mem.size/10000;
var tick = {
plot0: parseInt(mem)
};
callback(JSON.stringify(tick));
}
});
您的标题正在触发预检请求.
Your headers are triggering the preflight request.
如果您使用的是Angular,我会高度建议不要将jQuery用于AJAX,而应使用Angular的
If you're using Angular, I'd highly suggest not using jQuery for AJAX and instead use Angular's built-in $http service.
我在ZingChart团队中. Holler,如果我们可以为您提供图表方面的帮助.
I'm on the ZingChart team. Holler if we can help with your charts.