5 AJAX相对地址的问题

    $("#follow-button,.followTopic,.followerUser").click(function(){
        if(!check_login()){
            return ;
        }
        $(this).button('loading');
        var follow_btn = $(this);
        var source_type = $(this).data('source_type');
        var source_id = $(this).data('source_id');
        var show_num = $(this).data('show_num');

        $.get('/follow/'+source_type+'/'+source_id,function(msg){
            follow_btn.removeClass('disabled');
            follow_btn.removeAttr('disabled');
            if(msg =='followed'){
                follow_btn.html('已关注');
                follow_btn.addClass('active');
            }else{
                follow_btn.html('关注');
                follow_btn.removeClass('active');
            }

            /*是否操作关注数*/
            if(Boolean(show_num)){
                var follower_num = $("#follower-num").html();
                if(msg==='followed'){
                    $("#follower-num").html(parseInt(follower_num)+1);
                }else{
                    $("#follower-num").html(parseInt(follower_num)-1);
                }
            }
        });

    });


当网站放在文件夹下时,这里的相对地址造成404错误

请先 登录 后评论

最佳答案 2017-07-09 10:00

这都是什么?看不懂

请先 登录 后评论

其它 0 个回答

  • 1 关注
  • 0 收藏,3729 浏览
  • 乔布儿 提出于 2017-07-01 09:55

相似问题