首页 > 解决方案 > 我在将数据从 javascript 发送到 python 烧瓶时遇到问题

问题描述

我写了一个这样的javascript和HTML代码(内容是要显示的列表)。

    <script>
        function popupForModifying() {
            let option = "width=820, height=400, toolbar=no, menubar=no, location=no, directories=no, status=no, scrollbars=yes, resizable=no";
            window.open("{{ url_for('modify',  content=content[2], title=content[0], category=content[4]) }}", "", option);
        }
    </script>

    <article>
        <table class="table">
            <thead>
                <tr class="table-active">
                    <th class="col-8 text-left">{{ content[0] }}</th>
                    <th class="col-4"></th>
                </tr>
                <tr>
                    <td class="text-left">{{ content[4] }}&nbsp;&nbsp;
                        |&nbsp;&nbsp;{{ content[1] }}&nbsp;&nbsp;
                        |&nbsp;&nbsp;{{ content[3][0] }}</td>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td class="col-12 text-left">{{ content[2] }}</td>
                    <td class="col-0"></td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td>
                        <a class="btn btn-light" href="javascript:popupForModifying()">수정하기</a>
                    </td>
                </tr>
            </tfoot>
        </table>
    </article>

我写了这样的python代码。

@app.route('/modify', methods=['GET'])
def modify():
    title, category, content = (request.args.get(i) for i in ('title', 'category', 'content'))
    return render_template('modify_content_n.html', title=title, category=category, content=content)

但是,除了标题,所有变量都没有。所以,我找到了原因。最后,我明白了原因,但这让我很困惑。这就是我找到的原因。

127.0.0.1 - - [09/Aug/2020 21:53:09] “GET /modify?title=2+입니다&content=2고요&category=데이터 HTTP/1.1”200 -

韩语只是数据。为什么是'amp;' 随附的?

标签: javascriptpythonhtmlflask

解决方案


推荐阅读