Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery 您好,这是将数字变量传递给模板文本中的函数的正确方法吗? 函数生成卡(标题、内容、备忘录编号){ 让temp_html=` ${title} ${content} 수정 삭제 `; $(“#卡片盒”).append(临时html); }_Jquery_Ajax_Mongodb_Flask - Fatal编程技术网

Jquery 您好,这是将数字变量传递给模板文本中的函数的正确方法吗? 函数生成卡(标题、内容、备忘录编号){ 让temp_html=` ${title} ${content} 수정 삭제 `; $(“#卡片盒”).append(临时html); }

Jquery 您好,这是将数字变量传递给模板文本中的函数的正确方法吗? 函数生成卡(标题、内容、备忘录编号){ 让temp_html=` ${title} ${content} 수정 삭제 `; $(“#卡片盒”).append(临时html); },jquery,ajax,mongodb,flask,Jquery,Ajax,Mongodb,Flask,我的代码是这样的,我使用数据库中的数据创建卡片 关于变量memo_num,它作为数字变量提供给makeCard()。 那么,在这个模板文本中,这是将变量传递给函数“updateArticle()”的正确方法吗 在过去的经验中,当我将“”放在${}周围时,它起了作用(不过对于字符串变量) 当前该按钮没有执行它应该执行的操作。如果这确实是一个烧瓶应用程序,那么您将按照以下步骤操作。基本上,在使用render template函数之后,您可以在参数中定义变量,然后在html代码中使用双大括号调用它们,

我的代码是这样的,我使用数据库中的数据创建卡片

关于变量memo_num,它作为数字变量提供给makeCard()。 那么,在这个模板文本中,这是将变量传递给函数“updateArticle()”的正确方法吗

在过去的经验中,当我将“”放在${}周围时,它起了作用(不过对于字符串变量)


当前该按钮没有执行它应该执行的操作。

如果这确实是一个烧瓶应用程序,那么您将按照以下步骤操作。基本上,在使用
render template
函数之后,您可以在参数中定义变量,然后在html代码中使用双大括号调用它们,因此您可以说
{{title}

        function makeCard(title, content, memo_num) {
            let temp_html = `<div class="card" id="card number${memo_num}">
                                <div class="card-body">
                                <h3 id="memo_title" class="card-title">${title}</h3>
                                <h4 id="memo_content" class="card-text">${content}</h4>
                                <button type="button" class="btn btn-secondary btn-sm" onclick="updateArticle(${memo_num})">수정</button>
                                <button type="button" class="btn btn-dark btn-sm" onclick="deleteArticle(${memo_num})">삭제</button>
                                </div>
                             </div>`;

            $("#cards-box").append(temp_html);
        }