Javascript 用于 HTTPS

Javascript for HTTPS

我一直在研究 google、bing 等等,试图找出如何让我的脚本正确地 运行,但是 google chrome 说它试图从未经身份验证的来源加载脚本,我不是 100% 确定那是什么意思。

这是我的登录页面 运行 在本地主机上没问题,但 chrome 不喜欢 运行 脚本。

<script src="http://code.jquery.com/jquery-1.9.1.js"></script>
    <script>
      $(function () {

        $('#login').on('submit', function (e) {

          e.preventDefault();

          $.ajax({
            type: 'post',
            url: 'calls.php',
            data: $('#login').serialize(),
            success: function (data, response) {
            if(data==1)
            {    window.location.href = "/account.php";
                return false;}
            else{ $( ".result" ).html( data );}
            }
          });

        });

      });
    </script>
<div style="background-image:url('img/doxramos.png'); background-size:100% 100%; width:455px; height:188px;margin-left:auto; margin-right:auto;"></div>
  <form method="post" class="login" id="login" action="calls.php">
  <input type="hidden" name="process" id="process" value="login">
      <label for="login">Email:</label>
      <input type="text" name="username" id="username" placeholder="name@example.com">
    </p>

    <p>
      <label for="password">Password:</label>
      <input type="password" name="password" id="password" placeholder="Password">
    </p>

    <p class="login-submit">
      <button type="submit" class="login-button" id="submit">Login</button>
    </p>

    <p class="forgot-password"><a href="index.html">Forgot your password?</a></p>
  </form>
<div class = "result" style="text-align:center; margin-left:auto; margin-right:auto;"></div>

这意味着您 运行 当前 file/page 使用 SSL,但您从非 https URL 获取资源。

只需更改 URL

<script src="https://code.jquery.com/jquery-1.9.1.js"></script>