dongqiang4986 2015-01-28 08:01
浏览 112

AJAX没有加载其他js和css样式

I wrote a short AJAX code which is getting Facebook contents from a PHP file (in the PHP file I have declared class="gallery-img-link" as <a> and class="img-responsive img-thumbnail" as <img>).

I have the gallery-img-link on the bottom of site as jQuery script, the problem is when I add those classes by hand its working fine, but when I try to load those by a AJAX get request it seems to doesn't work.

Should I use it in a document.ready function?

I have tried live as well, but that didn't helped at all.

                          $(document).ready(function(){
                            $(\'#loading-image\').show();
                              $.ajax({
                                method:\'get\',
                                url:\'ajax.php\',
                                success:function(data){
                                  $("#facebook").html(data);
                                    },
                                complete: function(){
                                 $(\'#loading-image\').hide();
                                }
                              });
                          });
  • 写回答

2条回答 默认 最新

  • doomli3721 2015-01-28 08:13
    关注

    For all JavaScript DOM manipulations you Need the DOM to be fully loaded.

    Without having your PHP and other Code around I can just correct your JS:

    $(document).ready(function(){
          $('#loading-image').show();
          $.ajax({
               method: get ,
               url: ajax.php ,
               success: function(data){
                    $("#facebook").html(data);
               },
               complete: function(){
                    $('#loading-image').hide();
               }
           });  
    });
    

    UPDATE:

    Go Into the f12 Developer Tools in your Browser, and go to the Network Tab, then have a llok o all loaded Files, on should be ajax.php. Have a look what the File of that COntent is

    评论

报告相同问题?

悬赏问题

  • ¥15 2020长安杯与连接网探
  • ¥15 关于#matlab#的问题:在模糊控制器中选出线路信息,在simulink中根据线路信息生成速度时间目标曲线(初速度为20m/s,15秒后减为0的速度时间图像)我想问线路信息是什么
  • ¥15 banner广告展示设置多少时间不怎么会消耗用户价值
  • ¥16 mybatis的代理对象无法通过@Autowired装填
  • ¥15 可见光定位matlab仿真
  • ¥15 arduino 四自由度机械臂
  • ¥15 wordpress 产品图片 GIF 没法显示
  • ¥15 求三国群英传pl国战时间的修改方法
  • ¥15 matlab代码代写,需写出详细代码,代价私
  • ¥15 ROS系统搭建请教(跨境电商用途)