【问题标题】:Uncaught TypeError: $(...).dialog is not a function on server未捕获的 TypeError: $(...).dialog 不是服务器上的函数
【发布时间】:2016-05-07 05:15:32
【问题描述】:

当我在实时服务器上运行我的代码时出现此错误,但在 localhost Uncaught TypeError: $(...).dialog is not a function 上运行它时没有出现此错误

完整的错误是:

未捕获的 TypeError: $(...).dialog 不是函数(匿名 函数)@UploadPOD.aspx?id=uploadOutturn:69 n @ jquery-1.7.1.min.js:2 o.fireWith @ jquery-1.7.1.min.js:2 e.extend.ready @ jquery-1.7.1.min.js:2 c.addEventListener.B @ jquery-1.7.1.min.js:2

jQuery 有什么问题吗?

<link href="../CSS/DSStyleSheet.css" rel="Stylesheet" />
    <link href="JS/jquery-ui-1.10.1.custom/css/ui-lightness/jquery-ui-1.10.1.custom.css" rel="Stylesheet" /> 
    <link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/base/jquery-ui.css" />
    <script src="../JS/jquery-ui-1.8.17.custom/js/jquery-1.7.1.min.js" type="text/javascript"></script> 

为什么我的本地主机上没有出现这个错误?

【问题讨论】:

  • jQuery UI 没有加载
  • href="JS" 和 href="../JS" 确定两个路径都正确吗?
  • 也许你没有上传 jQuery UI。
  • @adeneo 我该如何解决这个问题?
  • @AlexK。是的,路径是正确的

标签: javascript jquery asp.net typeerror


【解决方案1】:

你也应该加上jquery-uijquery

<link href="../CSS/DSStyleSheet.css" rel="Stylesheet" />
<link href="JS/jquery-ui-1.10.1.custom/css/ui-lightness/jquery-ui-1.10.1.custom.css" rel="Stylesheet" /> 
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.10/themes/base/jquery-ui.css" />
<script src="../JS/jquery-ui-1.8.17.custom/js/jquery-1.7.1.min.js" type="text/javascript"></script> 
<script src="//code.jquery.com/ui/1.11.4/jquery-ui.js"></script>

错误在于它找不到函数$().dialog,因为它在jquery 中不存在。它是jquery-ui.js的函数

【讨论】:

  • 当我添加jquery-ui时收到错误object reference not set to an instance of an object
  • 您是否按照此处给出的顺序添加脚本?
【解决方案2】:

我认为你的jquery源路径不正确,所以请先检查脚本路径或者为了测试目的你可以使用CDN链接。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-05-15
    • 2020-04-15
    • 1970-01-01
    • 1970-01-01
    • 2022-01-07
    相关资源
    最近更新 更多