三种JS和AJAX


                    

我正在尝试通过AJAX将带有三个JS的简单模型加载到叠加层中。 第一次加载正在工作并且模型正在显示,但是一旦我关闭覆盖并再次打开它,则三个js不再加载。 </ p>

这是我加载三个js资产的方式:</ p>

  $。ajax({
     网址:url,
     输入:“ POST”,
     成功:功能(数据){
         $('#modal-container')。html(data);

         $ .getScript(“ https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js”);
         $ .getScript(“ https://cdn.jsdelivr.net/gh/mrdoob/three.js@r92/examples/js/loaders/GLTFLoader.js”);
         $ .getScript(“ assets / js / three-min.js”);

       }
});
</ code> </ pre>

是否有更好,更清洁的方法来实现这一目标? 这似乎也减慢了我的整个页面速度。</ p>
     </ div>

展开原文

原文

I am trying to load a simple model with THREE JS into an overlay via AJAX. The first load is working and the model is showing up, but as soon as I am closing the overlay and opening it again three js in not loading anymore.

Here is how I loaded the three js assets:

$.ajax({
    url: url,
    type: 'POST',
    success: function(data) {
        $('#modal-container').html(data);

        $.getScript("https://cdnjs.cloudflare.com/ajax/libs/three.js/110/three.min.js");
        $.getScript("https://cdn.jsdelivr.net/gh/mrdoob/three.js@r92/examples/js/loaders/GLTFLoader.js");
        $.getScript("assets/js/three-min.js");

      }
});

Is there a better, more cleaner, way of achieving this? It also seems to slow down my whole pagespeed.

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问