-5

我有以下 jQuery + PHP 代码,可在一台 PC 上运行,但不能在另一台 PC 上运行。

非工作:

<head>
  <script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
  <script type="text/javascript" src="javascripts/hrscripts/sortable.js"></script>
  <link href="/css/select2.css" rel="stylesheet"/>
  <script src="/javascripts/select2.js"></script>
  <script>
    $(document).ready(function() {
      $("#select_employee").select2();
    });
  </script>
</head>

<?php
  $allemp=$this->AllEmployees;
  echo "<form method='post' action='' id='employeesselection'>";
  echo "<select name='select_employee' id='select_employee'>";
  echo "<option value=''>Select an employee...</option>";

  foreach($allemp as $row) {
    $selected = ($row['Id'] == $_POST['select_employee'])?'selected="selected"':'';
    echo '<option '.$selected.' value="'.$row['Id'].'">'.$row['Etunimi'].' - '. $row['Sukunimi'].'</option>';
  }
  echo "</select>";

在职的:

<head>
  <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js" ></script>
  <link href="css/select2.css" rel="stylesheet"/>
  <script src="select2.js"></script>
  <script>
    $(document).ready(function() {
      $("#select_employee").select2();
    });
  </script>
</head>

<?php
  include "db.php";
  $employees=mysql_query("SELECT * FROM asiakas");

  echo "<form method='post' action='' id='employeesselection'><select name='select_employee' id='select_employee'>";

  while($row=mysql_fetch_array($employees)) {
    $selected = ($row['Id'] == $_POST['select_employee'])?'selected="selected"':'';
    echo '<option '.$selected.' value="'.$row['Id'].'">'.$row['Etunimi'].' - '. $row['Sukunimi'].'</option>';
  }
  echo "</select>

它几乎是相同的代码。我无法弄清楚我做错了什么。

4

2 回答 2

0

http:// 丢失:

<script src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
于 2013-04-17T12:18:15.220 回答
0

在同一个浏览器上检查两个结果,并确保所有页面脚本都已加载,您可以在 chrome 上从“f12 -> 资源 -> 脚本”执行此操作

于 2013-04-17T12:22:28.603 回答