Recently I installed a web application and it works correctly, absolutely everything, the problem is that when I install an SSL certificate, and place it in HTTPS protocol, the ajax functions that return a JSON type response give me an error, and I can not find the way to debug it since it only happens when I enter HTTPS mode, the rest works, the other ajax functions that do not return JSON, also work, only those that give me a JSON response.
<script>
jQuery("#search_login").click(
function(event){
var user_login = document.getElementById('login_username');
var user_pwd = document.getElementById('password_username');
jQuery.ajax({
type:'POST',
url:'wp-admin/login.php',
data: jQuery("#login-form").serialize(),
success:function(data){
var check = JSON.parse(data);
var done_account = check.done;
if(check.user_unknow === "UNKNOW"){
jQuery('#user_wrong').replaceWith('<label id="incorrect_user" style="color:#d82e21">Usuario incorrecto</label>');
}else{
jQuery('#incorrect_user').replaceWith('<p id="user_wrong"></p>');
}
if(done_account === 'done'){
jQuery('#session_check').replaceWith('<label style="color:#54be73;"><br />Logeado con éxito</label>');
setTimeout(' window.location.href = "https://www.maseficsoluciones.com/dashboard_validate.php?userData='+check.data+'&id='+check.user_id+'&user='+check.user_name+'&permission='+check.permission+'" ',1000);
}
if(check.pw_wrong === "FAIL"){
jQuery('#fail_account').replaceWith('<label id="incorrect_pwd" style="color:#d82e21">Contraseña incorrecta por favor intentalo de nuevo.<br /></label>');
}else{
jQuery('#incorrect_pwd').replaceWith('<p id="fail_account"></p>');
}
},error:function(data){
console.log(data);
},
});
return false;
});
</script>
WEB CONSOLE ERROR:
Uncaught SyntaxError: Unexpected token e in JSON at position 0
at JSON.parse (<anonymous>)
at Object.success (proyecto_home.php:607)
at i (jquery.js:2)
at Object.fireWith [as resolveWith] (jquery.js:2)
at y (jquery.js:4)
at XMLHttpRequest.c (jquery.js:4)