Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

113
Vistas
The submission form was duplicated in the ajax response page using Django views.py

I am trying to use a form to submit the parameter to views.py and get the results back to the html. However, the form part was repeatedly display in the page. enter image description here

Here is my views.py

def fund_main_py(request):
    last_trade_date = request.GET['last_trade_date']
    print(last_trade_date)
    plot_div1, plot_div2 = fund_main_main(last_trade_date)
    return render(request, 'optionsfund.html', context={'plot_div1': plot_div1, 'plot_div2': plot_div2})

Here is my stocksettle.js

$(document).ready(function(){
    $("#btn_submit").click(function(){
        document.getElementById("result").innerHTML = '抓取中.... 若期限過長,請稍後1分鐘!';
        var stock_code = $("#stock_code").val();
        var last_trade_date = $("#last_trade_date").val();
        $.ajax({
            type: "GET",
            url: "/fund_main_py",
            data:{
                "stock_code":stock_code,
                "last_trade_date":last_trade_date
            },
            success: function (Data) {
                $("#result").html(Data);
            },
            error: function (e) {
                console.log(e);
            }
        });
    })
});

Here is my optionsfund.html

        <table border="0">
            <tr>
                <td><fieldset>
                    <span> 指數/股票代號 :</span>
                 <input type="button" id="btn_submit" value=" 查詢 ">
                </fieldset></td>
            </tr>
        </table>
        <span id="result">
            <span id="plot1">
                {% autoescape off %}
                    {{ plot_div1 }}
                {% endautoescape %}
            </span><br><br>
            <span id="plot2">
                {% autoescape off %}
                    {{ plot_div2 }}
                {% endautoescape %}
            </span>
        </span><br><br>
about 4 years ago · Santiago Gelvez
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda