[英]I get a problem with ajax get request can someone help me?
My code do not response any data to me.. bellow some code:我的代码没有向我响应任何数据.. 下面是一些代码:
<script type="text/javascript">
function matriculaFn(mat) {
$.ajax({
method: 'GET',
url:'My url API,
async: true,
crossDomain: false,
contentType: 'application/json;charset=utf-8',
dataType: 'json',
headers: {
"Authorization": "Token xxxprivatexxxxx"
},
options: {
useSSL: true
},
success: function(data) {
console.log(data);
var dados = JSON.stringify(data);
console.log(dados);
$("#IDDOCAMPO").val(data.AlgumaCoisa);
},
//error : function(xhr, status, error) {
// do stuff here
//var data = jQuery.getJSON(xhr.responseText);
//console.log(data);
//}
});
};
</script>
here is the error:这是错误:
jquery-3.3.1.min.js:2 OPTIONS https://url net::ERR_CERT_DATE_INVALID
jquery-3.3.1.min.js:2 选项https://url net::ERR_CERT_DATE_INVALID
Can't comment yet because I don't have enough rep but it looks as though this error is Chrome specific.还不能发表评论,因为我没有足够的代表,但看起来这个错误是 Chrome 特定的。 Have you tried other browsers?
你试过其他浏览器吗? If so, try some of the methods listed here: link
如果是这样,请尝试此处列出的一些方法: 链接
Other things you could try are:您可以尝试的其他事情是:
crossDomain: true,
or adding:或添加:
xhrFields: {
withCredentials: true
},
or because it's a GET request try:或者因为它是一个 GET 请求尝试:
dataType: 'jsonp',
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.