我有以下 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>
它几乎是相同的代码。我无法弄清楚我做错了什么。