鍍金池/ 問(wèn)答/HTML/ ajax的readyState一直為3

ajax的readyState一直為3

在node異步刷新時(shí),ajax的readyState一直為3,但是在瀏覽器的network能看到返回的數(shù)據(jù),我就是哪不到

if (xmlhttp.readyState==4 && xmlhttp.status==200)

                        {
                            if($('.body_pict').html()){
                                $('.body_pict').empty();
                                let obj = JSON.parse((xmlhttp.responseText));
                                let str=obj["thumbnails"];
                                if(str){
                                    $('.body_pict').append(str);
                                }else{
                                    console.log('沒(méi)有數(shù)據(jù)!')
                                }
                            }
                        }
                        其中(xmlhttp.responseText)為空![圖片描述][1]

回答
編輯回答
真難過(guò)

。。。。。我找到錯(cuò)誤的原因了,在ajax接受數(shù)據(jù)的判斷中忘記判斷另一種情況,導(dǎo)致數(shù)據(jù)一直接受不到

2017年5月23日 16:50
編輯回答
孤客

自己能找到錯(cuò)誤是很好的,做事兒需要細(xì)心一些,考慮盡量要全面一點(diǎn)兒

2018年9月5日 01:06