当我在本地计算机上尝试此代码时,它运行正常并放回我需要的数据但是当我把它放在网站服务器上时它不会超过...检查兼容性加载它在.post方法停止的东西
<script src="http://code.jquery.com/jquery-1.9.1.min.js" type="text/javascript"></script>
<!-- <script src="js/settings.js" type="text/javascript"></script>-->
<SCRIPT type="text/javascript">
pic1 = new Image(16, 16);
pic1.src = "loader.gif";
$(document).ready(function() {
$("#username").change(function() {
var usr = $("#username").val();
if (usr.length >= 3) {
$.post("check.php", {
username: "donald"
},
function(data, status) {
alert("Data: " + data + "\nStatus: " + status);
});
$("#status").html('<img src="loader.gif" align="absmiddle"> Checking availability...');
$.ajax({
type: "POST",
url: "check.php",
data: "username=" + usr,
error: function() {
aler('error');
},
success: function(msg) {
$("#status").ajaxComplete(function(event, request, settings) {
if (msg == 'OK') {
$("#username").removeClass('object_error'); // if necessary
$("#username").addClass("object_ok");
$(this).html(' <img src="accepted.png" align="absmiddle"> <font color="Green"> Available </font> ');
} else {
$("#username").removeClass('object_ok'); // if necessary
$("#username").addClass("object_error");
$(this).html(msg);
}
});
}
});
} else {
$("#status").html('<font color="red">The username should have at least
<strong>3</strong> characters.</font>');
$("#username").removeClass('object_ok'); // if necessary
$("#username").addClass("object_error");
}
});
});
//-->
</SCRIPT>
<style type="text/css">
body {
font-family:"Trebuchet MS";
font-size:12px;
}
.inn {
float:left;
font-size:14px;
border:solid 1px #000000;
width:143px;
font-family:Arial, Helvetica, sans-serif;
color:#0066CC;
font-weight:bold;
}
</style>
<table>
<tr>
<td width="35%" align="right" valign="middle" id="abc">User Name :</td>
<td width="65%" align="left" valign="middle">
<input id="username" type="text" name="username" class="inn" /> http://xyz.com/<span id="username_url" style="color:#006600; font-weight:bold;">USERNAME</span>
</td>
</tr>
<tr>
<td></td>
<td align="left" valign="bottom" height="20px">
<div id="status"></div>
</td>
</tr>
</table>