zepto ajax callback not executing - Stack Overflow
为情所困
为情所困 2017-05-19 10:45:47
0
2
516
$.ajax({
        type: 'GET',
        url: 'data/teacher.json',
        dataType: 'json',
        success: function(data) {
            alert();
            var teacherArr = data.teacherList;
            var template = '';
            for(var i=0,len=teacherArr.length;i<len;i++) {
                var teacherInfo = teacherArr[i];
                var html = $('<li class="zy-teacher-list">'+
                                '<p class="fl zy-teacher-img">'+
                                    '<img src="'+teacherInfo.avatar+'" alt="">'+
                                '</p>'+
                                '<p class="fl zy-teacher-detail">'+
                                    '<dl>'+
                                        '<dt>'+
                                            '<p class="fl zy-teacher-name">'+
                                                +obj.name+
                                            '</p>'+
                                            '<p class="fl zy-nation-flag">'+
                                                '<img src="'+obj.nation+'" alt="">'+
                                            '</p>'+
                                            '<p class="fl zy-love-level">'+
                                                '<ul>'+
                                                    getLoveLevel(teacherInfo.loveLevel, teacherInfo.nation)+
                                                '</ul>'+
                                            '</p>'+
                                        '</dt>'+
                                        '<dd>'+
                                            '<p class="zy-teacher-char">'+
                                                '<ul>'+
                                                    '<li class="fl"><a href="###">'+teacherInfo.character[0]+'</a></li>'+
                                                    '<li class="fl"><a href="###">'+teacherInfo.character[1]+'</a></li>'+
                                                '</ul>'+
                                            '</p>'+
                                        '</dd>'+
                                    '</dl>'+
                                '</p>'+
                                '<p class="fr zy-order">'+
                                    '<p>'+
                                        '<a class="zy-order-now" href="###">'+getText(teacherInfo.free)+'</a>'+
                                        '<p class="zy-per-money">'+
                                            '<span>'+teacherInfo.money+'</span>美金/分钟'+
                                        '</p>'+
                                    '</p>'+
                                '</p>'+
                            '</li>')
                template+=html;
            }
            $('.zy-sec-teacher ul').appendTo(template);
        },
        error: function() {

        }

Code above

This is the chrome browser network display that I successfully requested the data, but the success function was not executed. What is the reason? . . .

This is my project directory, the request address is a json file written by myself, local server

为情所困
为情所困

reply all(2)
过去多啦不再A梦

Uh, please tell me what callback and err are?

Source

世界只因有你
callback 改成 success
err 改成 error
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template