Do you know how to access the textStatus variable after an ajax call? I need to use this variable in an if condition. Can anyone provide assistance? $this->registerJs("colorArray = ['#ff4c4c','#32CD32'];
$('.grooveTable').on('click','td', function(){
color = $(this).data('color') == undefined ? 0 : $(this).data('color')*2;
// Get Url Parameter
var result = [];
window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,
function(str, key, value) {
result[key] = value;
});
$.ajax({
url: '" . yii\helpers\Url::toRoute("area-chart/change-area-status") . "',
dataType: 'json',
method: 'GET',
data: {areaCodeId : $(this).attr('id'),colourCode:color, location:result['tion%5D'],
company_code:result['ny_code%5D'],division_code:result['rt%5Bdivision_code%5D']},
success: function (data, textStatus, jqXHR) {
statusCheck = data;
drawChart(data.idCompleted, data.idPending, data.idStarted);
},});
if(textStatus == 'SUCCESS' && color == undefined || color == colorArray.length ){
$(this).css('background-color',colorArray[0]);
$(this).data('color','0');
}else if(textStatus == 'SUCCESS' == 'UPDATE'){
$(this).css('background-color',colorArray[color+1]);
$(this).data('color',color+1);
}
});");