我的UI对话框不时有效,但通常会抛出此错误:
TypeError: $(...).dialog is not a function
我不知道为什么会这样。这是我的。 js 代码:
$( document ).ready(function() {
$("#dialog_box_hypo").dialog({
autoOpen: false,
width:'auto',
});
$("#dialog_box_kk").dialog({
autoOpen: false,
width:'auto',
});
$("#hypo_u_stats").click(function() {
$.ajax({
type: "GET",
url: "http://192.168.0.200/dev/vub/hypo_user_stats.php",
dataType: "html", //expect html to be returned
success: function(response){
$("#dialog_box_hypo").dialog({
autoOpen: false,
width:'auto',
});
$('#dialog_box_hypo').html(response);
$("#dialog_box_hypo").dialog( "open" );
}
});
});
$("#kk_u_stats").click(function() {
$.ajax({
type: "GET",
url: "http://192.168.0.200/dev/vub/kk_user_stats.php",
dataType: "html", //expect html to be returned
success: function(response){
$("#dialog_box_kk").dialog({
autoOpen: false,
width:'auto',
});
$('#dialog_box_kk').html(response);
$("#dialog_box_kk").dialog( "open" );
}
});
});
});
也许是由ajax调用引起的?这是我的.html:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="css/custom.css">
<script src="http://code.jquery.com/jquery-1.11.1.min.js"></script>
<script src="http://code.jquery.com/ui/1.11.1/jquery-ui.min.js"></script>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.11.1/themes/smoothness/jquery-ui.css" />
<script src="js/custom.js"></script>
</head>
<body>
<div id="dialog_box_hypo" title="Operátori HYPO"></div>
<div id="dialog_box_kk" title="Operátori KK"></div>
</body>
</html>
有人有任何想法吗?
提前致谢