小胡子未定义
Mustache undefined
我有一个使用 javascript 和 mustache 的工作网页已经停止工作可能是因为 Mustache 未定义。
有什么想法可以使它再次运行吗?
这是页面的开头...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
<title>Solar_BTU_Log Web Access</title>
<script type="text/javascript" src="https://github.com/janl/mustache.js/raw/master/mustache.js"></script>
<script type="text/javascript" src="SBL_JavaScript.js"></script>
<link rel="stylesheet" type="text/css" href="SBL_Styles.css"></link>
</head>
<body>
<div id="divA">
<p><b>Site: {{site}}</b></p>
<p><b>Time: {{time}}</b></p>
<p><b>Date: {{date}}</b></p>
<p><b>Pump: {{pump_state}}</b></p>
<p><b>Collector Temp: {{collector_0}}</b></p>
<p><b>Storage Temp: {{storage_0}}</b></p>
<p><b>BTUs Collected Today: {{btus_3}}</b></p>
<p><b>BTUs Collected Overall: {{btus_0}}</b></p>
<p><b>Ouside Temp: {{waux4_0}}</b></p>
<p><b>Probe Table</b></p>
{{{ptable}}}
<p><b>Statistics Table</b></p>
{{{stable}}}
</div>
<p>Here are some links...</p>
<ul>
<li><a href="SBL_Probes.htm">Raw Probe Data</a></li>
<li><a href="SBL_Stats.htm">Raw Statistics Data</a></li>
<li><a href="SBL_Doc.htm">SBL Web Documentation</a></li>
</ul>
<script type="text/javascript">
// Initialization, make sure Mustache is available
LogOn();
Log("<b>Start</b>");
function Fail (txt)
{
document.getElementById("divA").innerHTML =
"<p>" + txt + ", processing terminated</p><p>Press reload to try again</p>";
exit;
}
if(typeof Mustache=="undefined")
{
Log("Mustache undefined");
Fail("Critical component Mustache unavailable");
}
生成诊断 "Critical componenet Mustache unavailable"。
如评论中所述,Github 资源未作为资产正确加载到您的项目中。
我的建议是将实际的 Mustache 资产包含在您的项目文件夹中,这样您就可以确定该资产始终可用于您的项目。
@blex 也提出了一个很好的观点,您可以使用资源 rawgit.com 将 Github link 转换为可用的 url 来导入您的资产。
我有一个使用 javascript 和 mustache 的工作网页已经停止工作可能是因为 Mustache 未定义。
有什么想法可以使它再次运行吗?
这是页面的开头...
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-type" content="text/html;charset=UTF-8"/>
<title>Solar_BTU_Log Web Access</title>
<script type="text/javascript" src="https://github.com/janl/mustache.js/raw/master/mustache.js"></script>
<script type="text/javascript" src="SBL_JavaScript.js"></script>
<link rel="stylesheet" type="text/css" href="SBL_Styles.css"></link>
</head>
<body>
<div id="divA">
<p><b>Site: {{site}}</b></p>
<p><b>Time: {{time}}</b></p>
<p><b>Date: {{date}}</b></p>
<p><b>Pump: {{pump_state}}</b></p>
<p><b>Collector Temp: {{collector_0}}</b></p>
<p><b>Storage Temp: {{storage_0}}</b></p>
<p><b>BTUs Collected Today: {{btus_3}}</b></p>
<p><b>BTUs Collected Overall: {{btus_0}}</b></p>
<p><b>Ouside Temp: {{waux4_0}}</b></p>
<p><b>Probe Table</b></p>
{{{ptable}}}
<p><b>Statistics Table</b></p>
{{{stable}}}
</div>
<p>Here are some links...</p>
<ul>
<li><a href="SBL_Probes.htm">Raw Probe Data</a></li>
<li><a href="SBL_Stats.htm">Raw Statistics Data</a></li>
<li><a href="SBL_Doc.htm">SBL Web Documentation</a></li>
</ul>
<script type="text/javascript">
// Initialization, make sure Mustache is available
LogOn();
Log("<b>Start</b>");
function Fail (txt)
{
document.getElementById("divA").innerHTML =
"<p>" + txt + ", processing terminated</p><p>Press reload to try again</p>";
exit;
}
if(typeof Mustache=="undefined")
{
Log("Mustache undefined");
Fail("Critical component Mustache unavailable");
}
生成诊断 "Critical componenet Mustache unavailable"。
如评论中所述,Github 资源未作为资产正确加载到您的项目中。
我的建议是将实际的 Mustache 资产包含在您的项目文件夹中,这样您就可以确定该资产始终可用于您的项目。
@blex 也提出了一个很好的观点,您可以使用资源 rawgit.com 将 Github link 转换为可用的 url 来导入您的资产。