【发布时间】:2018-04-16 06:51:04
【问题描述】:
我正在尝试实现一个 mailchimp 弹出我的页面,但它不起作用。为了确保这不是由于 js 冲突,我尝试了他们在一个简单的 html 页面上提供的 JS 代码。
<!DOCTYPE html>
<html lang='en'>
<head>
<meta charset="utf-8">
<title>testpop</title>
</head>
<body>
<style>
html {
background: #3a1c71;
font-family: 'helvetica neue';
text-align: center;
font-size: 10px;
}
</style>
<!-- Here is the mailchimp js -->
<script type="text/javascript" src="//downloads.mailchimp.com/js/signup-forms/popup/embed.js" data-dojo-config="usePlainJson: true, isDebug: false"></script><script type="text/javascript">require(["mojo/signup-forms/Loader"], function(L) { L.start({"baseUrl":"//mc.us17.list-manage.com","uuid":"af12c8121a0cbbd603454ea9e","lid":"4904281888"}) })</script>
</body>
</html>
然后我收到以下消息:
获取文件://downloads.mailchimp.com/js/signup-forms/popup/embed.js net::ERR_FILE_NOT_FOUND testmail.html:18 Uncaught ReferenceError: require is not defined
我认为也许源不应该以 '//....' 但就像'http://...'
我现在在控制台中没有看到任何错误,但也没有弹出窗口
【问题讨论】:
-
问题是你的JS中没有定义
require()。 -
@BenM 我是 JS 新手,我该如何定义它?
标签: javascript popup mailchimp