gpt4 book ai didi

javascript - 嵌入式 SurveyJS 问题

转载 作者:行者123 更新时间:2023-12-03 01:37:06 24 4
gpt4 key购买 nike

我正在按照指南 ( https://surveyjs.io/Survey/Builder/ ) 在我的页面中嵌入调查。

在上述网站上>嵌入调查>

  • 使用 jQuery
  • 对于引导框架
  • 在页面上显示调查。

我有一个 Laravel 应用程序,页面呈现此源代码:

<!DOCTYPE html>
<html lang="en">
<head>
<title>The Survey Page </title>

<!-- Your platform (jquery) scripts. -->
<link href="https://surveyjs.azureedge.net/1.0.28/survey.css" type="text/css" rel="stylesheet" />
<script src="https://surveyjs.azureedge.net/1.0.28/survey.jquery.min.js"></script>

</head>

<body>
<div id="surveyContainer"></div>
<script> alert("This is the survey blade right here right now"); </script>
<script>
var surveyJSON = {pages:[{name:"page1",elements:[{type:"paneldynamic",name:"question2",templateElements:[{type:"radiogroup",name:"question3",choices:["item1","item2","item3"]},{type:"text",name:"question4"}]},{type:"paneldynamic",name:"question1"}]}]}

function sendDataToServer(survey) {
//send Ajax request to your web server later. Meantime...
alert("The results are:" + JSON.stringify(survey.data));
}

var survey = new Survey.Model(surveyJSON);
$("#surveyContainer").Survey({
model: survey,
onComplete: sendDataToServer
});
</script>


</body>
</html>
  • 所以,我收到了警报和一个空白页。
  • 外部脚本引用的格式正确
  • 脚本是页面上的最后一个内容(按顺序)

在控制台中,我得到这个:

survey.jquery.min.js:11 Uncaught TypeError: Cannot read property 'fn' of undefined
at Object.<anonymous> (survey.jquery.min.js:11)
at t (survey.jquery.min.js:6)
at survey.jquery.min.js:6
at survey.jquery.min.js:6
at survey.jquery.min.js:6
at survey.jquery.min.js:6
(anonymous) @ survey.jquery.min.js:11
t @ survey.jquery.min.js:6
(anonymous) @ survey.jquery.min.js:6
(anonymous) @ survey.jquery.min.js:6
(anonymous) @ survey.jquery.min.js:6
(anonymous) @ survey.jquery.min.js:6

showSurvey:23 Uncaught ReferenceError: Survey is not defined
at showSurvey:23

showSurvey 是我的 Controller 方法。

public function showSurvey()
{
return view ('surveys.survey'); //the laravel blade.. although it's just HTML as per the tutorial example
}

我做错了什么?

最佳答案

请替换以下行:

  <!-- Your platform (jquery) scripts. -->

  <script src="https://unpkg.com/jquery"></script>

关于javascript - 嵌入式 SurveyJS 问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51019281/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com