-1

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

Matheus Cabral
  • 162
  • 4
  • 18

1 Answers1

1

Can't comment yet because I don't have enough rep but it looks as though this error is Chrome specific. 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:

dataType: 'jsonp',
miriad
  • 136
  • 3
  • 8