I am trying to handle session timeout for Dropzone AJAX Fileupload Requests.I am checking the type of request through this if condition in PHP:
if (isset($_SERVER['HTTP_X_REQUESTED_WITH']) && !empty($_SERVER['HTTP_X_REQUESTED_WITH']) &&
strtolower($_SERVER['HTTP_X_REQUESTED_WITH']) == 'xmlhttprequest')
{
//Here checking if session is set or not
// If session is not set, I am responsing with
http_response_code(401);
}
JS File
error: function (jqXHR, exception) {
console.log(jqXHR.status); //Here Recieving as error instead of 401
if (jqXHR.status == 401) {
window.location.href="<?php base_url() ?>login";
}
},
But in the Jquery AJAX's error function, I am getting the status as error and not 401. Is this Dropzone's doing? Is Dropzone returning the error text ?