vendredi 7 août 2020

jQuery.inArray is not showing proper result, is code correct

here is my code

 if (jQuery.inArray(photos[i]['m_sys_cd'], arra) != '-1') {

                    j = arra.indexOf(photos[i]['m_sys_cd']);
                    console.log(photos[i]['m_sys_cd']);

                    //arra1.splice(photos[i]['m_sys_cd'],1) ;   

                    arra1 = jQuery.grep(arra1, function(value) {
                        return value != photos[i]['m_sys_cd'];
                    });


                    if(photo_dtl[j].is_archieved == 1  ){
                        console.log("if archieved");
                         src = '/storage/images/no_preview.jpeg'; 
                         photo_value="no_preview.jpeg";
                    }else{
                         console.log("else archieved")
                         src = '/storage/images/' + photo_dtl[j].m_photo_url;
                         photo_value=photo_dtl[j].m_photo_url;

                    }
else
{***code***}
}

arra values = ['2','7','5']

photos[i]['m_sys_cd'] = ['0','3','2','1','7','5']

even query has boolean result it is not going inside if loop



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire