douchui4815 2017-09-22 16:49
浏览 75
已采纳

为什么JQuery Code无法在Server上运行?

JQuery code is written as below and it is not working on web server. What may be the problem?

Code

$(document).ready(function(){
        function loadData(page){ 
            document.getElementById('catebox').style.display = 'none';  
            $.ajax
            ({
                type: "POST",
                url: "webcate.php",
                data: "page="+page,
                success: function(msg)
                {   
                    $("#container").ajaxComplete(function(event, request, settings)
                    {
                        $("#container").html(msg);
                    });
                }
            });
         }  

         loadData(1);
    });

Included File

Following file is included.

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js"></script>  

Problem

The code runs on local but does not work on server. Normal javascript works fine. But jquery does not work on web server.

Any solution would be appreciated.

  • 写回答

1条回答 默认 最新

  • doupike2351 2017-09-22 16:52
    关注

    You use Protocols http://... in your page to replace it with a url of https://....

    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 本地测试网站127.0.0.1 已拒绝连接,如何解决?(标签-ubuntu)
  • ¥50 Qt在release捕获异常并跟踪堆栈(有Demo,跑一下环境再回答)
  • ¥30 python,LLM 文本提炼
  • ¥15 关于将inet引入的相关问题
  • ¥15 关于一个倒计时的操作和显示设计
  • ¥15 提问STK的问题,哪位航天领域的同学会啊
  • ¥15 苹果系统的mac m1芯片的笔记本使用ce修改器使用不了
  • ¥15 单相逆变的电压电流双闭环中进行低通滤波PID算法改进
  • ¥15 关于#java#的问题,请各位专家解答!
  • ¥15 如何卸载arcgis 10.1 data reviewer for desktop