TypeError:json2html不是函数

问题描述 投票:0回答:1

[尝试使用json2html发出表。获取错误TypeError:json2html不是函数

页面标题具有:

<head>
    <meta charset="utf-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Index</title>
    <link rel="stylesheet" href="/lib/bootstrap/dist/css/bootstrap.css" />
    <link rel="stylesheet" href="/lib/jqueryui/jquery-ui.css" />
    <link rel="stylesheet" href="/lib/font-awesome/css/fontawesome.css" />

    <script src="/lib/jquery/dist/jquery.js"></script>
    <script src="/lib/jqueryui/jquery-ui.js"></script>
    <script src="/lib/font-awesome/js/fontawesome.js"></script>
    <script src="/lib/canvasjs/canvasjs.js"></script>
    <script src="/lib/json2html/json2html.js"></script>
    <script src="/lib/jquery.json2html/jquery.json2html.js"></script>

    <link rel="stylesheet" href="/css/site.css" />
</head>

使用ctrl-shift-i确认的文件/lib/json2html/json2html.js/lib/jquery.json2html/jquery.json2html.js的路径

我希望最初执行的方法是:

$("#tableContainer").html(json2html(data, transform));

TypeError: json2html is not a function
at Object.layer2CallbackHandler [as callback] (https://localhost:44388/JsonChartJs:306:35)
at Object.success (https://localhost:44388/JsonChartJs:220:41)
at fire (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:3268:32)
at Object.fireWith [as resolveWith] (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:3398:8)
at done (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:9305:15)
at XMLHttpRequest.<anonymous> (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:9548:10)

我也根据the json2html page的jquery示例对此进行了尝试>

$("#tableContainer").json2html(data, transform);

TypeError: $(...).json2html is not a function
at Object.layer2CallbackHandler [as callback] (https://localhost:44388/JsonChartJs:306:30)
at Object.success (https://localhost:44388/JsonChartJs:220:41)
at fire (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:3268:32)
at Object.fireWith [as resolveWith] (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:3398:8)
at done (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:9305:15)
at XMLHttpRequest.<anonymous> (c:\users\lukem\source\ctrack.dashboard\ctrack.dashboard\wwwroot\lib\jquery\dist\jquery.js:9548:10)

显然我是用错误的方式加载这些。什么是正确的方法?

尝试使用json2html发出表。收到错误TypeError:json2html不是函数页眉具有:

jquery json2html
1个回答
0
投票

如果要对json2html使用jquery插件,则还需要在标头中包含它

© www.soinside.com 2019 - 2024. All rights reserved.