Jquery load()不工作 $(文档).ready(函数() { $('#list')。更改(函数() { 如果($(this.val()=='College') { $.ajax({ url:'ajax.php'; 成功:功能(数据) { $('#content').html(数据); } }); } }); }); 挑选 弗斯特 第二 第三
脚本应该加载外部文件“ajax.php”,但它没有加载。我尝试使用alert(“”)而不是加载它,它运行良好,但它没有运行$.ajax。如果ajax代码中有错误,必须在url属性Jquery load()不工作 $(文档).ready(函数() { $('#list')。更改(函数() { 如果($(this.val()=='College') { $.ajax({ url:'ajax.php'; 成功:功能(数据) { $('#content').html(数据); } }); } }); }); 挑选 弗斯特 第二 第三,jquery,Jquery,脚本应该加载外部文件“ajax.php”,但它没有加载。我尝试使用alert(“”)而不是加载它,它运行良好,但它没有运行$.ajax。如果ajax代码中有错误,必须在url属性url:'ajax.php'后加逗号而不是分号。代码应该是 <html> <head> </head> <body> <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jq
url:'ajax.php'后加逗号代码>而不是分号。代码应该是
<html>
<head>
</head>
<body>
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js"></script>
<script>
$(document).ready(function()
{
$('#list').change(function()
{
if ($(this).val() === 'College')
{
$.ajax({
url: 'ajax.php';
success: function(data)
{
$('#content').html(data);
}
});
}
});
});
</script>
<select id="list">
<option value="">Select</option>
<option value="College">First</option>
<option value="Second">Second</opion>
<option value="Third">Third</option>
</select>
<div id='content'></div>
</body>
</html>
尝试调试更多错误。是否已在网络中签入?有错误吗?它是否进入成功处理程序?如果没有,尝试添加一个错误并调查返回的错误。打开浏览器的JS控制台并查看错误消息。代码是错误的url:'ajax.php';你必须在那里用逗号而不是分号
$.ajax({
url: 'ajax.php',
success: function(data)
{
$('#content').html(data);
}
});